[Select] Add comment on why padding-right is enforced on Select component #24453
Labels
component: select
This is the name of the generic UI component, not the React module!
docs
Improvements or additions to the documentation
good first issue
Great for first contributions. Enable to learn the contribution process.
https://github.com/mui-org/material-ui/blob/42954448866f204b0cf7e35127d5d0af9c24d6fb/packages/material-ui/src/NativeSelect/NativeSelect.js#L42-L44
In the above src code, the
paddingRight
style is applied with higher (double) class specificity to the component. Strangely, this is the only style rule applied in this way. This means, to override this style, I have to use the exact same pattern in my makeStyles class, i.e.the above works.
However, by not following the exact same pattern to override, and instead applying the
paddingRight
in the same way as the other padding values, then the underlying NativeSelect style takes priority. As you can see in the Chrome style window (see image), the specificity of Mui's implementation means it cannot be overridden using the simple class prop.(
.MuiSelect-select.MuiSelect-select
is ranked higher than.makeStyles-select-2357
)Screenshot of Chrome style window
Why does the style specified in NativeSelect use the higher specificity (double ampersand)? Is what I have done the expected way to override the right padding in this case?
The text was updated successfully, but these errors were encountered: