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

[system] Add getColorSchemeSelector util #32868

Merged
merged 2 commits into from
May 27, 2022

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented May 23, 2022

From https://github.com/mui/material-ui/pull/32835/files#r877687572, this PR adds a simple util to prevent hard-coded style like this:

styled('div')(({ theme }) => ({
  [theme.getColorSchemeSelector('dark')]: {
     // becomes '[data-mui-color-scheme="dark"] &'
     ...styles for dark mode
  }
})

without this util, the bug appears when developers provide a custom attribute to CssVarsProvider:

<CssVarsProvider attribute="data-company-color-scheme">

// HTML
<html data-company-color-scheme="dark">

Unit and regression tests are added.


Sorry, something went wrong.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@siriwatknp siriwatknp requested a review from mnajdova May 23, 2022 04:04
@siriwatknp siriwatknp added the package: system Specific to @mui/system label May 23, 2022
@mui-bot
Copy link

mui-bot commented May 23, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 4abe3c5

@siriwatknp siriwatknp merged commit be24437 into mui:master May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: system Specific to @mui/system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants