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] Warn when calling setMode without configuring colorSchemeSelector #43783

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

siriwatknp
Copy link
Member

From #43533 (comment)

Currently with CSS theme variables enabled, calling setMode has no effect if colorSchemeSelector is not configured. Technically, this is correct because the default method is @media (prefers-color-scheme), so user cannot toggle mode manually.

However, from the DX perspective, it's confusion of why it does not work. This PR added a warning if calling setMode without configuring colorSchemeSelector.

@siriwatknp siriwatknp added package: system Specific to @mui/system enhancement This is not a bug, nor a new feature labels Sep 16, 2024
@siriwatknp siriwatknp changed the title [system] Warn/use color scheme [system] Warn when calling setMode without configuring colorSchemeSelector Sep 16, 2024
@mui-bot
Copy link

mui-bot commented Sep 16, 2024

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against c26a0bc

@siriwatknp
Copy link
Member Author

siriwatknp commented Nov 11, 2024

@aarongarciah Sorry for the delay, I applied your suggesion. Could you do another review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature package: system Specific to @mui/system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants