Hello!
Please see this minimal repo using the Link component, as well as the Link component and Menu components from Chakra UI.
I am contributing to a project that is using these packages and updating their main navigation to use the Menu components. Per Chakra usage, MenuItem normally renders a button, but can be a link. With a11y, you navigate the menu items via the arrow keys and not Tab.
In the project, ChakraLink is consuming the Link of this i18next package for the theming, then this custom component is consumed by MenuItem
The current issue is that this approach prevents the execution of onKeyDown event happening under the hood from the Chakra package. This event is being passed via MenuLink to MenuItem.
Could the innerRef being used by i18next Link be preventing this handler?
With the minimal repo, do the following:
- Click "Open Menu" so the two list items appear
- Press the down arrow key, and notice no default focus styles.
- In the component file, replace
BaseLink with "a" for both MenuItems's then repeat the process to see the default focus styles on press of the down arrow key.
For references:
Hello!
Please see this minimal repo using the Link component, as well as the
Linkcomponent andMenucomponents from Chakra UI.I am contributing to a project that is using these packages and updating their main navigation to use the
Menucomponents. Per Chakra usage, MenuItem normally renders a button, but can be a link. With a11y, you navigate the menu items via the arrow keys and notTab.In the project,
ChakraLinkis consuming theLinkof this i18next package for the theming, then this custom component is consumed byMenuItemThe current issue is that this approach prevents the execution of
onKeyDownevent happening under the hood from the Chakra package. This event is being passed viaMenuLinktoMenuItem.Could the
innerRefbeing used by i18nextLinkbe preventing this handler?With the minimal repo, do the following:
BaseLinkwith"a"for bothMenuItems's then repeat the process to see the default focus styles on press of the down arrow key.For references:
useMenuList.useMenuListis called aslistPropsand spread toMenuTransitionwhich is a motion component.