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

[LoadingButton] Fix HTML rule button > div forbidden nesting #38584

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Aug 21, 2023

The issue can be seen on https://validator.w3.org/nu/?doc=https%3A%2F%2Fmui.com%2Fmaterial-ui%2Freact-button%2F

Screenshot 2023-08-22 at 00 53 52

While I don't know how useful validator.w3 is, I don't think Material UI component should create noise for developers.

Preview: https://deploy-preview-38584--material-ui.netlify.app/material-ui/react-button/.

I have checked if the bug could be reproduced on Joy UI at the same time, it can't, we use span correctly there.


This has been on my backlog for almost 2 years. I moved most of the items to Notion tasks, but this one seems so simple to fix that I'm going for it.

I saw two CSS bugs on this page with Material UI v6 https://mui.com/material-ui/react-button/#material-you-version:

Screenshot 2023-08-22 at 00 57 06

And

Screenshot 2023-08-22 at 00 57 20

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: LoadingButton The React component. labels Aug 21, 2023
@mui-bot
Copy link

mui-bot commented Aug 21, 2023

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against ba47316

@oliviertassinari oliviertassinari added the package: material-ui Specific to @mui/material label Aug 28, 2023
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

LGTM 🙌🏼

Sorry for the delay, this got lost in my notifications

@DiegoAndai
Copy link
Member

DiegoAndai commented Aug 31, 2023

Is the letter spacing the bug from the second image? That value is correct. From Material You's guidelines, the way to calculate letter spacing is (Tracking value in px / font size in px) = letter spacing in rem (reference). As the Button uses the label large tokens, this would be 0.1 / 14 = 0.00714....

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Aug 31, 2023

Is the letter spacing the bug from the second image?

@DiegoAndai

  1. I would question the number of digits it takes in serve side output and the dev tool. We used:

function round(value) {
return Math.round(value * 1e5) / 1e5;
}

in the stable version.

  1. Material Design pushing for rem on the unit seems very strange (unless I'm missing something, it's wrong). The same outcome can be reached by using em while also better supporting customize font size values. Material UI v5 and Joy UI feels correct:

letterSpacing: '-0.025em',

? { letterSpacing: `${round(letterSpacing / size)}em` }

A bit related to https://stackoverflow.com/questions/39692615/is-it-possible-to-have-letter-spacing-relative-to-the-font-size-and-inherit-prop

@oliviertassinari oliviertassinari merged commit d6fc0fd into mui:master Aug 31, 2023
21 checks passed
@oliviertassinari oliviertassinari deleted the fix-button-html-error branch August 31, 2023 18:36
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Sep 8, 2023
anon-phantom pushed a commit to anon-phantom/material-ui that referenced this pull request Sep 11, 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: LoadingButton The React component. package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants