Changing alert back to a focus and fixing tests

This commit is contained in:
Jonathan Bobel
2025-04-02 11:39:07 -04:00
parent 38451d77ad
commit 193184983d
4 changed files with 12 additions and 9 deletions

View File

@@ -10,11 +10,13 @@ function announceUploadStatusFromElement() {
if (message) {
srRegion.textContent = '';
setTimeout(() => {
srRegion.textContent = message;
}, 50);
srRegion.textContent = message + '\u00A0'; // add a non-breaking space
srRegion.focus(); // Optional
}, 300);
}
}
// Exported for use in tests
function initUploadStatusAnnouncer() {
document.addEventListener('DOMContentLoaded', () => {

View File

@@ -14,6 +14,7 @@
<div id="upload-status-live"
class="usa-sr-only"
aria-live="assertive"
tabindex="-1"
role="status">
</div>
<script nonce="{{ csp_nonce() }}">document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>