-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[ButtonBase] Ensure that onClick propagates when non-native button is clicked #30145
base: master
Are you sure you want to change the base?
[ButtonBase] Ensure that onClick propagates when non-native button is clicked #30145
Conversation
Just noticed that I have some failing tests, fixing now. |
Okay, fixed the tests. If we need to pass the original keyboard event to the onClick handler then there's still a bit more work to do, but waiting to look into that until I get some feedback! |
Hi @kmurgic! Thanks for your PR. The change you introduced makes a lot of sense as it improves consistency between using the native |
I spent a little time digging and I couldn't find another good way to trigger the event propagation. The best I could do was to fire the event on the parent element, but then the event has the wrong target element. I'm throwing in the towel on doing this without breaking changes, but someone else may want to try. If we can't fix this bug then maybe MUI should document somewhere the known issue with keyboard accessibility when using an onClick on the Menu component. |
Let's keep this PR open. We'll get back to it once we're closer to v6. |
@michaldudak should we close this now that v6 is released? |
@DiegoAndai - do you know what's the status of this? |
I think we can include this fix in v7. I am changing the branch where we want to fix this (to master). cc @DiegoAndai |
Signed-off-by: Marija Najdova <[email protected]>
This should solve #30144. I don't believe there are any unintended negative consequences from programmatically clicking the button, but someone please double check me on that. Although, one concern could be this being a breaking change for someone who is checking to see if the button onClick function was triggered by a keyboard event? I'm open to suggestions for different fixes to this bug if we need to make sure we are still passing the keyboard event to the onClick handler.