| Tech | Version |
|---------------------|---------|
| material-ui-pickers | 2.0.5 |
| material-ui | 3.8.1 |
| React | 16.7.0 |
| Browser | any |
| Peer library | date-fns |
MuiPickersDay.selectedNo MUI warnings
Material UI throws a warning:
Warning: Material-UI: the `MuiPickersDay` component increases the CSS specificity of the `selected` internal state.
You can not override it like this:
{
"selected": {
"backgroundColor": "#002d52",
"color": "#fff",
"&:hover": {
"backgroundColor": "#003B64"
}
} ...
}
Instead, you need to use the $ruleName syntax:
{
"&$selected": {
"backgroundColor": "#002d52",
"color": "#fff",
"&:hover": {
"backgroundColor": "#003B64"
}
}
}
https://material-ui.com/customization/overrides#internal-states
The code for this warning was introduced here:
https://github.com/mui-org/material-ui/pull/13919
It seems there are conventions around the specific keys 'disabled', 'focused', 'selected', 'checked'
I have the same issue. How can I fix it?
Same issue here with MuiListItem disabled
Same issue here with MuiListItem disabled
@andrispraulitis
The MuiListItem Component is a Component of the @material-ui/core package and isnt in any relation with this project.
But never mind - I can help you :)
Just do something link this in your theme:
"MuiListItem": {
"root": {
"&$disabled": {
// your disabled styles here
}
}
}
Thanks, I was missing root prop there
@janhoeck I still have some issues with your solution, I receive a warning message Warning: Material-UI: you are trying to override a style that does not exist. Fix the 'root' key of theme.overrides.MuiPickersDay.and the app crash because Uncaught TypeError: Cannot read property '&$selected' of undefined
const theme = createMuiTheme({
MuiPickersDay: {
root: {
'&$selected': {
backgroundColor: 'black',
'&:hover': {
backgroundColor: 'black',
},
},
},
},
})
@RobelTekle you are right, this solution does not work with material-ui-pickers. We have to wait for a bug fix from @dmtrKovalenko or we do a pull-request.
this issue still occurs, please fix it
@hcygit Provide a way to reproduce.
Please check my codesandbox, it shows the cause of the error and commented out the way to fix it:
overrides: {
MuiPickersDay: {
day: {
'&$selected': {
color: "red"
}
},
}
}
@novascreen Thank you, solved. It's all because of the wrong example code in the official site....
@novascreen : Thanks a lot. The issue got fixed. material-ui-pickers documentation should be modified properly.
@RobelTekle it worked for me after wasting few hours thanks.
Thanks for this. My code was working, but I was getting an error. I had to change:
MuiBottomNavigationAction: {
selected: {
color: "#2179ee",
},
},
to:
MuiBottomNavigationAction: {
root: {
"&$selected": {
color: "#2179ee",
},
},
},
Thanks for this. My code was working, but I was getting an error. I had to change:
MuiBottomNavigationAction: { selected: { color: "#2179ee", }, },to:
MuiBottomNavigationAction: { root: { "&$selected": { color: "#2179ee", }, }, },
@jrwstevenson
remove the commas like this { root: { "&$selected": { color: "#2179ee" } } }
I have the following problem...
This works:
MuiInput: {
disabled: {
color: '#282c2e',
'&:before': {
borderColor: '#e5e5e5 !important',
pointerEvents: 'none',
},
}
},...
But this Material UI recommendation returns error:
"&$disabled": {
"color": "#282c2e",
"&:before": {
"borderColor": "#e5e5e5 !important",
"pointerEvents": "none"
}
}
How can I disable that annoying warning?
My version: "@material-ui/core": "^3.9.3",
I have the following problem...
This works:
MuiInput: {
disabled: {
color: '#282c2e',
'&:before': {
borderColor: '#e5e5e5 !important',
pointerEvents: 'none',
},
}
},...But this Material UI recommendation returns error:
"&$disabled": {
"color": "#282c2e",
"&:before": {
"borderColor": "#e5e5e5 !important",
"pointerEvents": "none"
}
}How can I disable that annoying warning?
My version: "@material-ui/core": "^3.9.3",
the same problem
Same issue here with MuiListItem disabled
@andrispraulitisThe MuiListItem Component is a Component of the @material-ui/core package and isnt in any relation with this project.
But never mind - I can help you :)Just do something link this in your theme:
"MuiListItem": { "root": { "&$disabled": { // your disabled styles here } } }
It works for my MuiButton
Most helpful comment
The MuiListItem Component is a Component of the @material-ui/core package and isnt in any relation with this project.
But never mind - I can help you :)
Just do something link this in your theme: