-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Closed
Copy link
Labels
component: ButtonBaseThe React component.The React component.scope: buttonChanges related to the button.Changes related to the button.type: bugIt doesn't behave as expected.It doesn't behave as expected.v9.x
Milestone
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
When a Menu has an onClick prop, clicking on a nested MenuItem triggers the onClick, but pressing spacebar or enter while a nested MenuItem is focused does not.
Expected behavior 🤔
When a Menu has an onClick prop, clicking on a nested MenuItem triggers the onClick, and so does pressing spacebar or enter while a nested MenuItem is focused
Steps to reproduce 🕹
https://codesandbox.io/s/basicmenu-material-demo-forked-34vqi?file=/demo.js:849-866
Steps:
- Click on the menu
- Click on a button - notice that "clicked menu" is logged to the console
- Click on the menu
- Navigate to a button using the mouse
- Press spacebar - notice that "clicked menu" is not logged to the console
Context 🔦
I was trying to create a custom ActionMenu component that by default closed whenever any buttons inside of it were clicked because I didn't want to have to call handleClose from the click handler of every single menu item.
Your environment 🌎
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component: ButtonBaseThe React component.The React component.scope: buttonChanges related to the button.Changes related to the button.type: bugIt doesn't behave as expected.It doesn't behave as expected.v9.x
Projects
Status
Done