-
Notifications
You must be signed in to change notification settings - Fork 69
Description
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
BaseLinkwith"a"for bothMenuItems's then repeat the process to see the default focus styles on press of the down arrow key.
For references:
- The custom onKeyDown event in
useMenuList. - The MenuList component where
useMenuListis called aslistPropsand spread toMenuTransitionwhich is a motion component. - Chakra Link docs
- Chakra Menu docs