Improved toast accessibility, improved batch accessibility

This commit is contained in:
2025-11-23 21:47:03 +01:00
parent a63323cc3b
commit 48f0eb0e7e
5 changed files with 60 additions and 7 deletions

View File

@@ -67,7 +67,10 @@
const asset = json.assetsModel;
assetCard.innerHTML = `
<div class="card-body" data-cn="${asset.Cn}">
<h4 class="card-title mb-4" style="text-align: center;"><button class="btn btn-sm btn-danger" data-action="remove" data-batchid="${i}" style="float:left;">X</button><strong>Asset ${i + 1}:</strong> ${asset.Name}</h4>
<span>
<h4 tabindex="0" class="card-title mb-4" style="text-align: center;"><strong aria-label="Asset ${i + 1}: ${asset.Name}">Asset ${i + 1}:</strong> ${asset.Name}</h4>
<button class="btn btn-sm btn-danger" data-action="remove" data-batchid="${i}" aria-label="@T["Delete entry"]" style="float:left;">X</button>
</span>
<div class="row">
<div class="col-md-5">
<p><strong>@T["Asset ID"]:</strong> ${asset.Cn}</p>
@@ -87,7 +90,10 @@
} else {
assetCard.innerHTML = `
<div class="card-body">
<h4 class="card-title mb-4" style="text-align: center;"><button class="btn btn-sm btn-danger" data-action="remove" data-batchid="${i}" style="float:left;">X</button><strong>Asset ${i + 1}:</strong> @T["Empty"]</h4>
<span>
<h4 tabindex="0" class="card-title mb-4" style="text-align: center;"><strong aria-label="Asset ${i + 1}: @T["Empty"]">Asset ${i + 1}:</strong> @T["Empty"]</h4>
<button class="btn btn-sm btn-danger" data-action="remove" data-batchid="${i}" aria-label="@T["Delete entry"]" style="float:left;">X</button>
</span>
<div class="row">
<div id="printPreviewBatchButtons${i}" class="col-md-1 justify-content-end" style="margin-left: auto; width: auto;">
</div>
@@ -236,10 +242,14 @@
let cardAtIndex = document.querySelector(`[data-card-index="${index}"]`)
let cardBodyAtIndex = cardAtIndex.children[0];
cardBodyAtIndex.children[0].children[1].textContent = `Asset ${newIndex + 1}`;
cardBodyAtIndex.children[1].children[0].children[0].children[0].nextSibling.textContent = ` ${newIndex + 1}`;
cardBodyAtIndex.children[0].children[0].children[0].textContent = `Asset ${newIndex + 1}:`;
cardBodyAtIndex.children[0].children[0].children[0].ariaLabel = cardBodyAtIndex.children[0].children[0].children[0].ariaLabel.replace(/\s\d+\:/, ` ${newIndex + 1}:`);
let cardAtTarget = document.querySelector(`[data-card-index="${newIndex}"]`)
let cardBodyAtTarget = cardAtTarget.children[0];
cardBodyAtTarget.children[0].children[1].textContent = `Asset ${index - 0 + 1}`;
cardBodyAtTarget.children[1].children[0].children[0].children[0].nextSibling.textContent = ` ${index - 0 + 1}`;
cardBodyAtTarget.children[0].children[0].children[0].textContent = `Asset ${index - 0 + 1}:`;
cardBodyAtTarget.children[0].children[0].children[0].ariaLabel = cardBodyAtTarget.children[0].children[0].children[0].ariaLabel.replace(/\s\d+\:/, ` ${newIndex + 1}:`);
cardAtIndex.insertBefore(cardBodyAtTarget, null);
cardAtTarget.insertBefore(cardBodyAtIndex, null);

View File

@@ -1,8 +1,11 @@
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer T
<button id="openPrintModal"
class="btn btn-primary position-fixed bottom-0 start-0 m-4"
style="width: 3rem; height: 3rem;z-index: 1000;"
data-bs-toggle="modal"
data-bs-target="#printModal"
title="Open Print Page">
title="@T["Open Print Page"]">
🖨️
</button>