diff --git a/packages/next-ui/LayoutDefault/components/LayoutDefault.tsx b/packages/next-ui/LayoutDefault/components/LayoutDefault.tsx index ead2c606b8..c6f7256a85 100644 --- a/packages/next-ui/LayoutDefault/components/LayoutDefault.tsx +++ b/packages/next-ui/LayoutDefault/components/LayoutDefault.tsx @@ -147,7 +147,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
)}
-
+
{children}
{footer}
diff --git a/packages/next-ui/Navigation/components/NavigationOverlay.tsx b/packages/next-ui/Navigation/components/NavigationOverlay.tsx index 60b7a3a77e..d9c1e35906 100644 --- a/packages/next-ui/Navigation/components/NavigationOverlay.tsx +++ b/packages/next-ui/Navigation/components/NavigationOverlay.tsx @@ -81,6 +81,10 @@ export const NavigationOverlay = React.memo((props: NavigationOverlayProps) => { useEffect(() => { animating.set(true) + + if (activeAndNotClosing) { + a11yFocusRef.current?.focus() + } }, [activeAndNotClosing, animating]) const afterClose = useEventCallback(() => { @@ -127,16 +131,7 @@ export const NavigationOverlay = React.memo((props: NavigationOverlayProps) => { }, }} > - { - if (selectedLevel === 1 && a11yFocusRef.current) { - a11yFocusRef.current.focus() - } - }} - > + ({ @@ -160,7 +155,6 @@ export const NavigationOverlay = React.memo((props: NavigationOverlayProps) => { sx={{ boxShadow: 'none', my: fabMarginY }} size='responsive' aria-label={i18n._(/* i18n */ 'Back')} - ref={a11yFocusRef} > @@ -173,6 +167,7 @@ export const NavigationOverlay = React.memo((props: NavigationOverlayProps) => { sx={{ boxShadow: 'none', my: fabMarginY }} size='responsive' aria-label={i18n._(/* i18n */ 'Close')} + ref={a11yFocusRef} > diff --git a/packages/next-ui/SkipLink/SkipLink.tsx b/packages/next-ui/SkipLink/SkipLink.tsx index de52f89505..1ef9413948 100644 --- a/packages/next-ui/SkipLink/SkipLink.tsx +++ b/packages/next-ui/SkipLink/SkipLink.tsx @@ -2,10 +2,22 @@ import { Trans } from '@lingui/react' import { Link } from '@mui/material' export function SkipLink() { + const setFocus = (e) => { + e.preventDefault() + globalThis.document.querySelector('#skip-nav')?.focus() + globalThis.document.querySelector('#skip-nav')?.scrollIntoView() + } + return ( { + if (e.key === 'Enter') { + setFocus(e) + } + }} sx={(theme) => ({ position: 'absolute', top: theme.page.vertical,