-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select] - When the Select is disabled the dropdown arrow is not greyed out #19833
Comments
There is a reference to it in https://material.io/design/interaction/states.html#disabled. From what I understand, we could use inheritance (opacity) |
I'd like to try tackling this issue, but I wonder what is the best way to do it? |
@HenryLie What do you think of this patch? diff --git a/packages/material-ui/src/NativeSelect/NativeSelect.js b/packages/material-ui/src/NativeSelect/NativeSelect.js
index e3049ebab..32f04c9c5 100644
--- a/packages/material-ui/src/NativeSelect/NativeSelect.js
+++ b/packages/material-ui/src/NativeSelect/NativeSelect.js
@@ -72,7 +72,8 @@ export const styles = (theme) => ({
position: 'absolute',
right: 0,
top: 'calc(50% - 12px)', // Center vertically
- color: theme.palette.action.active,
+ color: 'currentColor',
+ opacity: 0.8,
pointerEvents: 'none', // Don't block pointer events on the select under the icon.
},
/* Styles applied to the icon component if the popup is open. */ I think that it would better communicate the styles we want. The same color as the text but less visually strong to account for the bigger surface of the arrow (compared to the text). It's to be noted that the Autocomplete component uses a different strategy: diff --git a/packages/material-ui/src/NativeSelect/NativeSelect.js b/packages/material-ui/src/NativeSelect/NativeSelect.js
index e3049ebab..bce383f85 100644
--- a/packages/material-ui/src/NativeSelect/NativeSelect.js
+++ b/packages/material-ui/src/NativeSelect/NativeSelect.js
@@ -74,6 +74,9 @@ export const styles = (theme) => ({
top: 'calc(50% - 12px)', // Center vertically
color: theme.palette.action.active,
pointerEvents: 'none', // Don't block pointer events on the select under the icon.
+ '&$disabled': {
+ color: theme.palette.action.disabled,
+ }
},
/* Styles applied to the icon component if the popup is open. */
iconOpen: {
diff --git a/packages/material-ui/src/Select/SelectInput.js b/packages/material-ui/src/Select/SelectInput.js
index 595b3001b..0a5000b2e 100644
--- a/packages/material-ui/src/Select/SelectInput.js
+++ b/packages/material-ui/src/Select/SelectInput.js
@@ -348,6 +348,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
/>
<IconComponent
className={clsx(classes.icon, classes[`icon${capitalize(variant)}`], {
+ [classes.disabled]: disabled,
[classes.iconOpen]: open,
})}
/> Maybe we should unify both, I wonder. |
@oliviertassinari I'll submit a PR that uses the |
@HenryLie Ok, this sounds fair 👍 |
@HenryLie You would need to increase specificity too with the disabled pseudo-class. |
I just submitted a PR to both fix the issue and unify the behavior with |
Current Behavior 😯
The dropdown arrow is not greyed out
Expected Behavior 🤔
As per the Material Design documentation, when a TextField or Select is disabled, everything should be greyed out, even Input Adornments:
Steps to Reproduce 🕹
https://codesandbox.io/s/gifted-brattain-og6xh
Context 🔦
Small design inconsistency.
Your Environment 🌎
The text was updated successfully, but these errors were encountered: