Skip to content

[DropdownMenu] DropdownMenu.CheckboxItem asChild keyboard issue #1268

Closed
@bengeorge

Description

@bengeorge

Bug report

Current Behavior

Given a CheckboxItem that has asChild={true} and is the first item in the dropdown.

When you use enter to activate the trigger:

  • Menu will not open
  • onCheckChange is called on the first menu item
  • If you add onSelect={(e) => e.preventDefault()} the menu does stay open

When you use space to activate the trigger:

  • Menu will open
  • onCheckChange is called on the first menu item

Expected behavior

Menu should open and first item should not have onCheckChange called.

Reproducible example

CodeSandbox Template

Steps to reproduce in this codesandbox:

  • Focus the trigger
  • enter, esc, enter, esc

You should see the menu open and close and the first item toggles on / off as you do this.

Suggested solution

Additional context

Your environment

Software Name(s) Version
Radix Package(s) dropdown-menu 0.1.6
React n/a
Browser chrome 99.0.4844.82
Assistive tech
Node n/a
npm/yarn
Operating System windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions