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

[joy] Fix persisting hover state styles on click on mobile #36704

Merged
merged 1 commit into from
May 29, 2023
Merged

[joy] Fix persisting hover state styles on click on mobile #36704

merged 1 commit into from
May 29, 2023

Conversation

gitstart
Copy link
Contributor

@gitstart gitstart commented Mar 30, 2023

Fixes button retaining hover effect on mobile devices.
One iteration on #36583
Preview: https://deploy-preview-36704--material-ui.netlify.app/joy-ui/react-button/


This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.

Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@mui-bot
Copy link

mui-bot commented Mar 30, 2023

Netlify deploy preview

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

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against f7a86fc

@gitstart gitstart marked this pull request as ready for review March 30, 2023 21:50
@gitstart
Copy link
Contributor Author

@oliviertassinari this PR is ready for review

@zannager zannager added package: base-ui Specific to @mui/base package: joy-ui Specific to @mui/joy labels Mar 31, 2023
@zannager zannager requested a review from siriwatknp March 31, 2023 07:51
@gitstart
Copy link
Contributor Author

What's the verdict on this? @siriwatknp

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍 Thanks for the fix. I'm so sorry to keep you waiting, lost track of it.

@siriwatknp siriwatknp merged commit 1c76c13 into mui:master May 29, 2023
{ '&:hover': theme.variants[`${ownerState.variant!}Hover`]?.[ownerState.color!] },
{
'&:hover': {
'@media (hover: hover)': theme.variants[`${ownerState.variant!}Hover`]?.[ownerState.color!],
Copy link
Member

@oliviertassinari oliviertassinari May 29, 2023

Choose a reason for hiding this comment

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

In Material UI, I don't recall why we used the opposite: #15000 (comment). It might have been because of IE 11 support https://caniuse.com/mdn-css_at-rules_media_hover which is no longer relevant. I think that it could be good to normalize on what works best between Joy UI and Material UI. I guess that the approach we use here has the advantage of being clearer to override. cc @DiegoAndai

At first sight, this in Joy UI looks better than in Material UI, e.g. for customization, it's more straightforward:

Screenshot 2023-06-01 at 15 55 10

@oliviertassinari oliviertassinari removed the package: base-ui Specific to @mui/base label May 29, 2023
@oliviertassinari oliviertassinari changed the title [base][joy] prevent persisting hover state styles onclick on mobile [joy] Fix persisting hover state styles on click on mobile May 29, 2023
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: button This is the name of the generic UI component, not the React module! labels May 29, 2023
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: button This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants