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] Configure MenuItems not to close the Menu when clicked #46

Closed
Tracked by #468
michaldudak opened this issue Aug 30, 2023 · 4 comments · Fixed by #468
Closed
Tracked by #468

[Menu] Configure MenuItems not to close the Menu when clicked #46

michaldudak opened this issue Aug 30, 2023 · 4 comments · Fixed by #468
Assignees
Labels
component: menu This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@michaldudak
Copy link
Member

mui/material-ui#38324 (comment)

Consider adding a prop (such as disableCloseOnClick) that modifies the default MenuItem behavior.

@mainakkaniam
Copy link

I would like to look into this matter. From what you said what I understood is that you meant this behaviour: in the official MUI menu docs , there is a "Dashboard" example , on clicking menu appears and on clicking any of the menuitem it disappears. You want to give an option to the developer to keep the menu alive even when the user clicks on any of menuitem.
Please confirm and would love to have some help regarding how to approach the problem.

@michaldudak
Copy link
Member Author

That's correct. This can be implemented in the useMenuItem hook (createHandleClick function). Add the disableClosingOnClick parameter to the hook, check its value in the click handler, and call dispatch({ type: DropdownActionTypes.close }) only when it's false.
Please also add a test verifying this behavior.

@michaldudak michaldudak removed their assignment Nov 23, 2023
@Jaswanth-Sriram-Veturi
Copy link

Can I work on this issue?

@michaldudak
Copy link
Member Author

Go ahead!

@michaldudak michaldudak transferred this issue from mui/material-ui Feb 27, 2024
@michaldudak michaldudak changed the title [Menu][base-ui] Configure MenuItems not to close the Menu when clicked [Menu] Configure MenuItems not to close the Menu when clicked Feb 27, 2024
@michaldudak michaldudak added component: menu This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature labels Feb 27, 2024
@github-project-automation github-project-automation bot moved this from Selected to Done in Base UI Alpha Aug 2, 2024
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! enhancement This is not a bug, nor a new feature
Projects
Archived in project
3 participants