diff --git a/src/components/elements/ombed.tsx b/src/components/elements/ombed.tsx index 279cefb2..51bae185 100644 --- a/src/components/elements/ombed.tsx +++ b/src/components/elements/ombed.tsx @@ -13,7 +13,6 @@ const Oembed = ({url, ...props}: Props) => { const ref = useRef(null) const entry = useIntersectionObserver(ref, {freezeOnceVisible: true}); return ( - // @ts-ignore
{!!entry?.isIntersecting && }/>}
diff --git a/src/components/elements/select-list.tsx b/src/components/elements/select-list.tsx index 0a9b9dde..8f099f71 100644 --- a/src/components/elements/select-list.tsx +++ b/src/components/elements/select-list.tsx @@ -113,9 +113,7 @@ const SelectList = ({options = [], label, multiple, ariaLabelledby, required, de ...props }); - useEffect(() => { - listboxVisible && listboxRef.current?.focus(); - }, [listboxVisible]); + useEffect(() => listboxRef.current?.focus(), [listboxVisible]); useLayoutEffect(() => { const parentContainer = listboxRef.current?.parentElement?.getBoundingClientRect(); diff --git a/src/components/menu/main-menu.tsx b/src/components/menu/main-menu.tsx index ec80b926..92bb699d 100644 --- a/src/components/menu/main-menu.tsx +++ b/src/components/menu/main-menu.tsx @@ -24,13 +24,11 @@ const MainMenu = ({menuItems}: { menuItems: DrupalMenuItem[] }) => { const handleEscape = useCallback((event: KeyboardEvent) => { if (event.key === "Escape" && menuOpen) { closeMenu() - - // @ts-ignore buttonRef.current?.focus(); } }, [menuOpen, closeMenu]); - useEffect(closeMenu, [browserUrl, closeMenu]); + useEffect(() => closeMenu(), [browserUrl, closeMenu]); useEffect(() => { // Add keydown listener for escape button if the submenu is open. @@ -80,7 +78,7 @@ const MenuItem = ({id, url, title, activeTrail, items, level = 0}: MenuItemProps const itemProps = useOutsideClick(closeSubmenu); // Close the submenu if the url changes. - useEffect(closeSubmenu, [browserUrl, closeSubmenu]); + useEffect(() => closeSubmenu(), [browserUrl, closeSubmenu]); useLayoutEffect(() => { // If the right side of the submenu is not visible, set the position to be on the left of the menu item. @@ -96,7 +94,6 @@ const MenuItem = ({id, url, title, activeTrail, items, level = 0}: MenuItemProps } }, [submenuOpen, closeSubmenu]); - useEffect(() => { // Add keydown listener for escape button if the submenu is open. if (submenuOpen) document.addEventListener("keydown", handleEscape); diff --git a/src/components/tools/editorially.tsx b/src/components/tools/editorially.tsx index 91cfc1fd..d95a4c2f 100644 --- a/src/components/tools/editorially.tsx +++ b/src/components/tools/editorially.tsx @@ -9,7 +9,8 @@ const Editori11y = () => { if (typeof Ed11y != 'undefined') { // @ts-ignore new Ed11y({ - checkRoots: '#main-content' + checkRoots: '#main-content', + ignoreElements: 'nav' }); } } diff --git a/src/lib/hooks/useNavigationEvent.tsx b/src/lib/hooks/useNavigationEvent.tsx index abb13d00..9ee270ef 100644 --- a/src/lib/hooks/useNavigationEvent.tsx +++ b/src/lib/hooks/useNavigationEvent.tsx @@ -1,19 +1,15 @@ 'use client'; import {usePathname} from 'next/navigation'; -import {useEffect, useRef, useState} from "react"; +import {useEffect, useState} from "react"; import {syncDrupalPreviewRoutes} from "@lib/drupal/sync-drupal-preview-path"; const useNavigationEvent = () => { - const isInitialMount = useRef(true); const [url, setUrl] = useState(); const pathname = usePathname(); useEffect(() => { - if (isInitialMount.current) { - isInitialMount.current = false; - return; - } + if (!pathname) return; if (pathname !== url && !(pathname?.startsWith('/gallery-image/'))) { setUrl(pathname ? pathname : null);