[Select] Recent removal of `.MuiSelect-root` class prevents specifically targeting root for only `Select`
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
Following the merge of this PR into version 5.1.1, we can no longer specifically target the root element of a Select explicitly without also targeting all Inputs. Having this root class for example allowed you to be able to add different padding for a Select component at the root but not for other Inputs.
I understand it was removed as a result of also removing the root
override slot because that usage was unclear - however I think we should still keep the class as that is useful for specificity purposes.
Expected behavior 🤔
.MuiSelect-root
is still available as a class on the root element but the slot is not available to apply styleOverrides to.
Steps to reproduce 🕹
Before Select root was removed (v5.1.0): codesanbox
After Select root was removed (v5.2.4): codesandbox
If you compare the two you will see that erroneous padding is present on the right side of the select in the “After” option because it is no longer able to target the Select root to override this.
Context 🔦
Without this root class style overrides get very complicated, very quickly if you are trying to apply varying styles to selects vs inputs vs multiline inputs and there are some styles you may not want just on the input element itself, but rather the wrapper (root). This has also broken our Select styles and prevented us from upgrading beyond 5.1.0 unless we do quite a bit of unconventional style hacking to get our theme back to where it was.
Your environment 🌎
`npx @mui/envinfo`
System:
OS: macOS 11.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 169.88 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm
Managers:
Homebrew: 3.3.7 - /usr/local/bin/brew
pip3: 21.2.4 - /usr/local/bin/pip3
RubyGems: 3.0.3 - /usr/bin/gem
Utilities:
Make: 3.81 - /usr/bin/make
GCC: 4.2.1 - /usr/bin/gcc
Git: 2.30.1 - /usr/bin/git
Clang: 13.0.0 - /usr/bin/clang
Servers:
Apache: 2.4.48 - /usr/sbin/apachectl
Virtualization:
Docker: 20.10.11 - /usr/local/bin/docker
IDEs:
IntelliJ: 2021.2.2
Nano: 2.0.6 - /usr/bin/nano
VSCode: 1.62.3 - /usr/local/bin/code
Vim: 8.2 - /usr/bin/vim
Xcode: /undefined - /usr/bin/xcodebuild
Languages:
Bash: 3.2.57 - /bin/bash
Java: 1.8.0_302 - /Users/steven.rathbauer/.sdkman/candidates/java/current/bin/javac
Perl: 5.30.2 - /usr/bin/perl
PHP: 7.3.29 - /usr/bin/php
Python: 2.7.16 - /usr/bin/python
Python3: 3.9.7 - /usr/local/bin/python3
Ruby: 2.6.3 - /usr/bin/ruby
Databases:
SQLite: 3.32.3 - /usr/bin/sqlite3
Browsers:
Firefox Developer Edition: 95.0
Safari: 15.1
Monorepos:
Yarn Workspaces: 1.22.15
Lerna: 4.0.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:23
- Comments:5 (2 by maintainers)
Top GitHub Comments
I strongly think that it’s a very common use case to style them differently
@hbjORbj are there any updates on it?
@rathpc The
root
styleOverride still works in MuiSelect if you need to use it.