Conversation
Change colorSchemeSelector from "class" to "data-mode" so that toggling dark mode updates the data-mode attribute and color-scheme CSS property on the root element, not just the CSS class.
ab0e25a to
84b61b9
Compare
akademy
left a comment
There was a problem hiding this comment.
Currently discussing if this is necessary.
Dark/Light Mode Toggling - Class/Style vs. Data AttributeWhen implementing a dark/light mode toggle, the core idea is to apply different styles based on the active theme. This can be achieved by manipulating HTML attributes on a high-level element (like 1. Changing
|
Summary
colorSchemeSelectorinBaseThemefrom"class"to"data-mode"so MUI toggles thedata-modeattribute on the root element whenColourSchemeButtonswitches dark modeNote: The ds-theme branch's
ThemeProvideralso needs aColorSchemeSyncfix (itsuseLayoutEffectsetsclassandcolor-schemeinline style from a staticmodeprop, which goes stale after toggling). That fix will go into ds-theme directly when it rebases on top of this.Fixes #130