Skip to content

Event Handler not reaching Link componentΒ #181

@TylerAPfledderer

Description

@TylerAPfledderer

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:

  1. Click "Open Menu" so the two list items appear
  2. Press the down arrow key, and notice no default focus styles.
  3. 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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions