Skip to content
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

[Button][base] Set active class when a subcomponent is clicked #35410

Merged

Conversation

michaldudak
Copy link
Member

@michaldudak michaldudak commented Dec 9, 2022

Sets the active state whenever a button's children have been clicked (in addition to previously supported button itself).
Also improved the logic of removing the active state - it's no longer necessary to release the mouse button while still hovering over the button.

Fixes #35164

@michaldudak michaldudak added component: button This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Dec 9, 2022
@michaldudak michaldudak requested a review from mnajdova December 9, 2022 13:13
@mui-bot
Copy link

mui-bot commented Dec 9, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-35410--material-ui.netlify.app/

Details of bundle changes

Generated by 🚫 dangerJS against e7e19f8

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Out of curiosity, does the current behavior acts the same as the ":active" CSS selector? If the answer is yes, do we even need this state?

@michaldudak
Copy link
Member Author

The :active pseudoclass is not applied when a custom element (e.g. not a <button>) is triggered with keyboard.

@mnajdova
Copy link
Member

The :active pseudoclass is not applied when a custom element (e.g. not a ) is triggered with keyboard.

I see the use-case, alright. I guess I will need to update the Material You button having this in mind. I will wait for this to get in first them :) I guess this is one of those cases where server components would not work cc @oliviertassinari

@michaldudak michaldudak merged commit 56c59c6 into mui:master Dec 13, 2022
@michaldudak michaldudak deleted the iss/35164-button-subcomponent-click branch December 13, 2022 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ButtonUnstyled] cannot trigger active status when click element inside button
3 participants