-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
[Tabs] Fix tabs activating incorrectly on non-primary button clicks #1318
Conversation
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
e59ac6f
to
504cda3
Compare
isPrimaryButtonRef.current = false; | ||
} | ||
|
||
if (!event.button || event.button === 0) { |
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.
We use
if (!event.button || event.button === 0) { | |
if (event.button === 0) { |
in all Material UI codebase. I have never seen someone open a bug because event.button
is missing. Could this reduce the bundle size here?
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.
Tried removing this check in NumberField here too but without it a test fails: https://app.circleci.com/pipelines/github/mui/base-ui/7042/workflows/cc6f84c4-5cc2-488c-b741-ebb30c275d4a/jobs/61996/parallel-runs/0/steps/0-106
Not sure if it's just a test issue but I'd prefer to keep the main button check the same for now CC @atomiks
504cda3
to
6e63c2b
Compare
</Tabs.Root>, | ||
); | ||
|
||
await user.pointer({ keys: '[MouseLeft>]', target: getAllByRole('tab')[1] }); |
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.
Interesting syntax?
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.
https://testing-library.com/docs/user-event/pointer/#pressing-a-button-or-touching-the-screen
pressing and releasing, also works for keyboard 😬 user.keyboard('{a>}') // press a without releasing it
Fixes #1317