Skip to content

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

Closed

Description

@entity

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.

Activity

  1. changed the title [-]Cannot select menu item via enter key[/-] [+][Menu] Cannot select menu item via enter key when rendered as link[/+] on Dec 24, 2024
  2. self-assigned this
    on Dec 24, 2024
  3. atomiks commented on Dec 27, 2024

    @atomiks
    Contributor

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

    event.preventDefault();

  4. added
    type: bugIt doesn't behave as expected.
    and removed on Dec 31, 2024
  5. mj12albert commented on Dec 31, 2024

    @mj12albert
    Member

    There weren't any tests for menu items or useButton rendering link components in the legacy package 🤔

  6. changed the title [-][Menu] Cannot select menu item via enter key when rendered as link[/-] [+][menu] Cannot select menu item via enter key when rendered as link[/+] on Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component: menuChanges related to the menu component.type: bugIt doesn't behave as expected.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions