Skip to content

[menu] Menu.Item adding data-highlighted to items that are disabled can cause unintended effects on styling and behavior #4881

@augusto-cesar-buildbox

Description

@augusto-cesar-buildbox

Bug report

Current behavior

The current behavior is adding the "data-highlighted" prop to menu items that are disabled. This causes some unintended behavior, such as the item's focus being directed to disabled items, and also affects the component's styling.

Expected behavior

When an item is disabled and you try to navigate to it using the keyboard, you should not focus on disabled items and also should not add the "data-highlighted" prop so as not to affect the styling.

Expected behavior

  1. Go to the official shadcn website, select the Dropdown Menu component, and select the "Base UI" tab to indicate that you want to use the Base UI components. (https://ui.shadcn.com/docs/components/base/dropdown-menu)
  2. Open the first example of the component with keyboard navigation.
  3. Navigate through the menu items until you see one that is disabled called "API".
  4. It will still be possible to focus on the navigation and add the unwanted prop.

Base UI version

v1.5.0

Which browser are you using?

Chrome

Which OS are you using?

Linux (CachyOS)

Additional context

menu-bug.mp4
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: menuChanges related to the menu component.type: expected behaviorThe current behavior is already the one expected.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions