1.8.3
Safari, Firefox, Chrome
React 16.4.1
Webpack
Create a Textfield with a label or placeholder and try to change primary color using ThemeProvider.
Example: https://codesandbox.io/s/pp65870mw7
Changing primary color should (?) also apply to label/placeholder text or at least a separate attribute should be available like there is for changing hint text.
Label/placeholder does not change.
I'm not quite sure this is an issue of rmwc, it may as well be a bug of material-components-web or I may be missing something.
This issue is also visible in the textfield examples page. Change the theme from the menu on the top-right and see the issue reproduce by clicking on a textfield. On the same topic, it seems I cannot change the color of the hint text either (using textHintOn*)
@Deilv This is a well documented issue with MDC. I actually have a PR proposal open to fix it.
https://github.com/material-components/material-components-web/pull/3145
https://github.com/material-components/material-components-web/issues/3066
We'll get around to fixing it upstream. In the meantime, a workaround for you (and anywhere else it is a problem)
Add this to some global css. Make sure it occurs after your MCW css, or you'll have to add an !important or make it more specific.
.mdc-text-field--focused:not(.mdc-text-field--disabled) .mdc-floating-label {
color: var(--mdc-theme-primary);
}
Thanks a lot for your reply and workaround:)
Hey! Any updates on that issue?
Jumping through a bunch or random issues brought me to this one which seems to be the main issue. https://github.com/material-components/material-components-web/issues/4709
The MDC team hears from me often enough about my love of runtime CSS vars. I鈥檇 say commenting there or opening an additional issue would show some support.
For my projects I generally just maintain a file of those fixes. I鈥檝e been hesitant to add one directly to MDC since the rules can get kind of crazy to fix it but it鈥檚 something I can consider.
After many years of dealing with these types issues, I've added a theme fixes file directly to RMWC that takes care of these little issues since I've had a hard time getting them fixed upstream. Will be out with V6.
Fixed in 6.0.0.
@jamesmfriedman Still getting this issue in 6.1.4. Maybe I don't understand the explanation on this page clearly. https://rmwc.io/theme You say to "include both", but I am not sure where or what the theme file is. Can you make it more explicit or give an example?
I can confirm this is still broken in 6.1.4
applying the aforementioned style fix also brakes error colour (is primary colour instead of red) adding :not(.mdc-text-field--invalid) to the selector fixes this.
this issue also affects the Select element
following style fixes this
.mdc-select:not(.mdc-select--disabled).mdc-select--focused .mdc-floating-label {
color: var(--mdc-theme-primary);
}
this does not fix the colour for the drop arrow
Most helpful comment
@Deilv This is a well documented issue with MDC. I actually have a PR proposal open to fix it.
https://github.com/material-components/material-components-web/pull/3145
https://github.com/material-components/material-components-web/issues/3066
We'll get around to fixing it upstream. In the meantime, a workaround for you (and anywhere else it is a problem)
Add this to some global css. Make sure it occurs after your MCW css, or you'll have to add an !important or make it more specific.