-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2267 from GSA/main
01-16-2025 Production Deploy
- Loading branch information
Showing
76 changed files
with
932 additions
and
1,483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
const sidenavItems = document.querySelectorAll('.usa-sidenav__item > .parent-link'); | ||
let lastPath = window.location.pathname; | ||
let debounceTimeout = null; | ||
|
||
sidenavItems.forEach((link) => { | ||
const parentItem = link.parentElement; | ||
const sublist = parentItem.querySelector('.usa-sidenav__sublist'); | ||
const targetHref = link.getAttribute('href'); | ||
|
||
// initialize the menu to open the correct submenu based on the current route | ||
if (window.location.pathname.startsWith(targetHref)) { | ||
parentItem.classList.add('open'); | ||
link.setAttribute('aria-expanded', 'true'); | ||
} | ||
|
||
link.addEventListener('click', (event) => { | ||
const currentPath = window.location.pathname; | ||
|
||
// prevent default behavior only if navigating to the same route | ||
if (currentPath === targetHref) { | ||
event.preventDefault(); | ||
return; | ||
} | ||
|
||
if (sublist && !parentItem.classList.contains('open')) { | ||
// debounce the menu update to avoid flickering | ||
clearTimeout(debounceTimeout); | ||
debounceTimeout = setTimeout(() => { | ||
parentItem.classList.add('open'); | ||
link.setAttribute('aria-expanded', 'true'); | ||
}, 50); | ||
} | ||
}); | ||
}); | ||
|
||
// handle browser back/forward navigation | ||
window.addEventListener('popstate', () => { | ||
const currentPath = window.location.pathname; | ||
|
||
// sync menu state | ||
sidenavItems.forEach((link) => { | ||
const parentItem = link.parentElement; | ||
const targetHref = link.getAttribute('href'); | ||
|
||
if (currentPath.startsWith(targetHref)) { | ||
parentItem.classList.add('open'); | ||
link.setAttribute('aria-expanded', 'true'); | ||
} else { | ||
parentItem.classList.remove('open'); | ||
link.setAttribute('aria-expanded', 'false'); | ||
} | ||
}); | ||
|
||
lastPath = currentPath; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,9 +87,6 @@ class Config(object): | |
"[email protected]", | ||
], | ||
} | ||
FEATURE_BEST_PRACTICES_ENABLED = ( | ||
getenv("FEATURE_BEST_PRACTICES_ENABLED", "false") == "true" | ||
) | ||
|
||
FEATURE_ABOUT_PAGE_ENABLED = getenv("FEATURE_ABOUT_PAGE_ENABLED", "false") == "true" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.