This commit is contained in:
CocoByte 2025-03-03 11:41:49 -07:00
parent e506604e7b
commit ea0e9e2f7e
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F
2 changed files with 2 additions and 11 deletions

View file

@ -701,6 +701,7 @@ export function initFilterFocusListeners() {
// Announce focus change for screen readers
announceForScreenReaders("Filter refocused on " + focusedElement.textContent);
localStorage.removeItem("admin_filter_focus_id");
}
}
@ -711,14 +712,5 @@ export function initFilterFocusListeners() {
clickedFilter = true; // Mark that a filter was clicked
});
});
// Clear focus selection in local storage if user is truly leaving the page
window.addEventListener("beforeunload", function(event) {
if (!clickedFilter) {
// If the user did not click a filter and the page is refreshing,
// clear the filter focus id from local storage
localStorage.removeItem("admin_filter_focus_id");
}
});
});
}

View file

@ -40,8 +40,7 @@ export function announceForScreenReaders(message) {
let liveRegion = document.createElement("div");
liveRegion.setAttribute("aria-live", "assertive");
liveRegion.setAttribute("role", "alert");
liveRegion.style.position = "absolute";
liveRegion.style.left = "-9999px";
liveRegion.setAttribute("class", "usa-sr-only");
document.body.appendChild(liveRegion);
// Delay the update slightly to ensure it's recognized