Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Menu] Cannot select menu item via enter key when rendered as link #1225

Open
heychazza opened this issue Dec 24, 2024 · 1 comment
Open
Assignees
Labels
component: menu This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@heychazza
Copy link

Bug report

Current behavior

When selecting a menu item that contains a link, for example using a Link component from Inertia.js's Link component, or react-routers, it just closes the menu and doesn't actually go to it. This works fine if you select it with your mouse just not via the enter key.

Expected behavior

I'd expect it to go to the url selected upon pressing the enter key, as it works fine when using the enter key.

Reproducible example

Link to a StackBlitz (You'll need to open the full preview to see the url change).

Base UI version

v1.0.0-alpha.4

Which browser are you using?

Safari, but not relevant here.

Which OS are you using?

Mac OS, but not relevant here.

Which assistive tech are you using (if applicable)?

N/A

Additional context

The browser shows the url at the bottom but it just closes the menu instead of executing the link.

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 24, 2024
@aarongarciah aarongarciah changed the title Cannot select menu item via enter key [Menu] Cannot select menu item via enter key when rendered as link Dec 24, 2024
@aarongarciah aarongarciah added the component: menu This is the name of the generic UI component, not the React module! label Dec 24, 2024
@mj12albert mj12albert self-assigned this Dec 24, 2024
@atomiks
Copy link
Contributor

atomiks commented Dec 27, 2024

@mj12albert This event.preventDefault() for useButton is the cause

event.preventDefault();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants