-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
[ButtonUnstyled] Fix keyboard navigation on customized elements #32204
Conversation
@material-ui/core: parsed: +Infinity% , gzip: +Infinity% |
4ce92e1
to
05be6d9
Compare
05be6d9
to
233561c
Compare
233561c
to
65aab14
Compare
Co-authored-by: Benny Joo <sldisek783@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I could validate that it works in https://codesandbox.io/s/mui-emotion-submit-reset-button-bug-forked-19l1h9?file=/src/App.js
In cases where we can't cover some fix with test, it is nice to have a codesandbox built with the PR packages to showcase that it works :)
Fixed the detection of native elements in useButton. It should be now possible to trigger click events on ButtonUnstyled, which root is a wrapped in a component.
Unfortunately, this is not unit-testable, as neither JSDOM, nor browsers trigger the click event when Enter or Space is pressed on a native button.
Also added a doc section about custom buttons not interacting with forms as their native counterparts.
Fixes #32193
The first commit contains the actual fix. The second is a cleanup of no longer needed
component
parameter fromuseButton
(this makes it more in-line with other hooks that are not concerned about thecomponent
orcomponents
).