Skip to content

[RAC] MenuItem should support closeOnSelect boolean for when pressed/selected #8208

Open
@kvnxiao

Description

@kvnxiao

Provide a general summary of the feature here

react-aria-component's MenuItem does not support an option to keep the Menu open after clicking on a specific MenuItem

🤔 Expected Behavior?

Support a boolean prop for MenuItem like closeOnSelect?: boolean, so that if it's false, the onAction handler fires but does not automatically close the menu

😯 Current Behavior

Any click on a MenuItem causes the entire menu to close

💁 Possible Solution

No response

🔦 Context

  1. I'd like to insert some menu item buttons and entries that have checkboxes, where I'd like to keep the menu open when a user selects the checkbox. These checkboxes are in a sub-menu, so the user experience is annoying if they have to keep reopening the menu and hovering over the sub-item to see the checkbox values in the submenu. This can be worked around with to an extent using the selectionMode prop for the Menu
  2. I'd like some menu items to act like a button that kicks off a side-effect and still keep the menu open afterwards after its selected and the onAction handler fires

💻 Examples

No response

🧢 Your Company/Team

Squint.ai

🕷 Tracking Issue

No response

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