mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 11:16:07 +02:00
cleanup
This commit is contained in:
parent
e506604e7b
commit
ea0e9e2f7e
2 changed files with 2 additions and 11 deletions
|
@ -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");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue