Skip to content

[base-ui][useMenuButton] Fix non native button triggers #40645

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

Merged
merged 5 commits into from
Jan 22, 2024

Conversation

DiegoAndai
Copy link
Member

@DiegoAndai DiegoAndai commented Jan 16, 2024

Discovered while working on #40643

The useButton hook must receive the ownProps to be able to call the trigger's onClick handler for non-native buttons. If done the other way around, otherHandlers.onClick is undefined here: https://github.com/DiegoAndai/material-ui/blob/base-select-non-button-trigger/packages/mui-base/src/useButton/useButton.ts#L146

Before: https://codesandbox.io/p/sandbox/kind-butterfly-4j9xnm
After: https://codesandbox.io/p/sandbox/distracted-neco-j3lqhz

@DiegoAndai DiegoAndai added bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Jan 16, 2024
@mui-bot
Copy link

mui-bot commented Jan 16, 2024

Netlify deploy preview

https://deploy-preview-40645--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 3d71adc

@michaldudak
Copy link
Member

Please add a test that verifies it.

@michaldudak michaldudak added this to the Base UI: Stable release milestone Jan 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@DiegoAndai DiegoAndai self-assigned this Jan 18, 2024
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@DiegoAndai DiegoAndai merged commit e0ab9be into mui:master Jan 22, 2024
@DiegoAndai DiegoAndai deleted the base-menu-non-native-trigger branch January 22, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants