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

[material-ui][Divider] Fix CSS specificity order #44204

Merged
merged 2 commits into from
Oct 27, 2024

Conversation

o-alexandrov
Copy link
Contributor

There's currently CSS specificity order issue.
If a user has a global CSS override, such as:

span: {
  whiteSpace: `pre-line`
}

Then Divider component will become broken, there'll be extra line breaks
visual-error

that's because the whiteSpace: 'nowrap' is currently set on the parent HTML element, instead of the actual wrapper.

css-order-bug

@zannager zannager added the component: divider This is the name of the generic UI component, not the React module! label Oct 25, 2024
@zannager zannager requested a review from DiegoAndai October 25, 2024 10:29
@ZeeshanTamboli ZeeshanTamboli added the package: material-ui Specific to @mui/material label Oct 27, 2024
@ZeeshanTamboli ZeeshanTamboli changed the title [Divider] Fix css specificity order [material-ui][Divider] Fix CSS specificity order Oct 27, 2024
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Can you provide a live reproduction of the issue in the form of StackBlitz or CodeSandbox?

@mui-bot
Copy link

mui-bot commented Oct 27, 2024

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against c9d3dcf

@o-alexandrov
Copy link
Contributor Author

@ZeeshanTamboli

See this repo for the repro; it's based on MUI's pigment vite example (but it isn't related to Pigment).

Then, here's a video on how to reproduce how this PR fixes it (removing style from the parent HTML element and applying to the span with text)

Screen.Recording.2024-10-27.at.6.29.49.AM.mov

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Looks good!

@ZeeshanTamboli ZeeshanTamboli merged commit f538258 into mui:master Oct 27, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: divider This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants