Improved locations screenreader navigation, fixed unable to delete location after editing

This commit is contained in:
2025-11-23 22:54:24 +01:00
parent 4f1c55d456
commit 647ca335ea

View File

@@ -40,7 +40,7 @@
foreach (LocationTableViewModel locationTableViewModel in Model.LocationTableViewModels) foreach (LocationTableViewModel locationTableViewModel in Model.LocationTableViewModels)
{ {
<tr> <tr>
<td>@locationTableViewModel.LocationID</td> <td tabindex="0">@locationTableViewModel.LocationID</td>
<td>@locationTableViewModel.LocationName</td> <td>@locationTableViewModel.LocationName</td>
<td>@locationTableViewModel.RoomNumber</td> <td>@locationTableViewModel.RoomNumber</td>
<td>@locationTableViewModel.Seat</td> <td>@locationTableViewModel.Seat</td>
@@ -234,6 +234,7 @@
const result = await response.json(); const result = await response.json();
if (result) { if (result) {
const btn = document.querySelector(`button[data-location-id="${data.Location}"]`); const btn = document.querySelector(`button[data-location-id="${data.Location}"]`);
const btn_del = document.querySelector(`button.btn-danger[data-location-id="${data.Location}"]`);
const row = btn.closest('tr'); const row = btn.closest('tr');
let slugifiedLocationID = `${data.Description.Location}-${data.Description.RoomNumber}-${data.Description.Seat}` let slugifiedLocationID = `${data.Description.Location}-${data.Description.RoomNumber}-${data.Description.Seat}`
.toLowerCase() .toLowerCase()
@@ -244,6 +245,10 @@
btn.setAttribute("data-location-name", data.Description.Location); btn.setAttribute("data-location-name", data.Description.Location);
btn.setAttribute("data-room-number", data.Description.RoomNumber); btn.setAttribute("data-room-number", data.Description.RoomNumber);
btn.setAttribute("data-seat", data.Description.Seat); btn.setAttribute("data-seat", data.Description.Seat);
btn_del.setAttribute("data-location-id", slugifiedLocationID);
btn_del.setAttribute("data-location-name", data.Description.Location);
btn_del.setAttribute("data-room-number", data.Description.RoomNumber);
btn_del.setAttribute("data-seat", data.Description.Seat);
row.children[0].textContent = slugifiedLocationID; row.children[0].textContent = slugifiedLocationID;
row.children[1].textContent = data.Description.Location; row.children[1].textContent = data.Description.Location;
row.children[2].textContent = data.Description.RoomNumber; row.children[2].textContent = data.Description.RoomNumber;
@@ -339,7 +344,7 @@
const tbody = document.querySelector('table tbody'); const tbody = document.querySelector('table tbody');
const newRow = document.createElement('tr'); const newRow = document.createElement('tr');
newRow.innerHTML = ` newRow.innerHTML = `
<td>${slugifiedLocationID}</td> <td tabindex="0">${slugifiedLocationID}</td>
<td>${newLoc.Location}</td> <td>${newLoc.Location}</td>
<td>${newLoc.RoomNumber}</td> <td>${newLoc.RoomNumber}</td>
<td>${newLoc.Seat}</td> <td>${newLoc.Seat}</td>