linting and fix bug when multiple accordions open in single section

This commit is contained in:
thomas.ekstrand 2024-02-24 09:31:48 -06:00
parent 97e9485040
commit bed46b5c79

View file

@ -49,7 +49,7 @@ const findNearestHeading = (element: Element): Element | null => {
*/ */
const updateUrlWithNearestHeadingId = (targetElementUuid: string): void => { const updateUrlWithNearestHeadingId = (targetElementUuid: string): void => {
const targetElement: HTMLElement | null = document.getElementById( const targetElement: HTMLElement | null = document.getElementById(
`accordion__heading-${targetElementUuid}`, `accordion__heading-${targetElementUuid[0]}`,
); );
const nearestHeading: Element | null = targetElement const nearestHeading: Element | null = targetElement
@ -63,7 +63,7 @@ const updateUrlWithNearestHeadingId = (targetElementUuid: string): void => {
// If they're all collapsed, remove the hash // If they're all collapsed, remove the hash
if (!targetElement) { if (!targetElement) {
window.location.hash = ''; window.location.hash = "";
} }
}; };