Skip to content

Commit

Permalink
[Select] Apply disabled color to the icon (#20287)
Browse files Browse the repository at this point in the history
* [NativeSelect] fix icon color on disabled state

* [Autocomplete] unify disabled icon color handling with NativeSelect

* [Autocomplete] Handle clear icon for consistency

* color instead of opacity?

Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
  • Loading branch information
HenryLie and oliviertassinari authored Mar 26, 2020
1 parent ac25d40 commit fb002af
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 0 additions & 2 deletions packages/material-ui-lab/src/Autocomplete/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export const styles = (theme) => ({
clearIndicator: {
marginRight: -2,
padding: 4,
color: theme.palette.action.active,
visibility: 'hidden',
},
/* Styles applied to the clear indicator if the input is dirty. */
Expand All @@ -143,7 +142,6 @@ export const styles = (theme) => ({
popupIndicator: {
padding: 2,
marginRight: -2,
color: theme.palette.action.active,
},
/* Styles applied to the popup indicator if the popup is open. */
popupIndicatorOpen: {
Expand Down
5 changes: 4 additions & 1 deletion packages/material-ui/src/NativeSelect/NativeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ export const styles = (theme) => ({
position: 'absolute',
right: 0,
top: 'calc(50% - 12px)', // Center vertically
color: theme.palette.action.active,
pointerEvents: 'none', // Don't block pointer events on the select under the icon.
color: theme.palette.action.active,
'&$disabled': {
color: theme.palette.action.disabled,
},
},
/* Styles applied to the icon component if the popup is open. */
iconOpen: {
Expand Down
6 changes: 5 additions & 1 deletion packages/material-ui/src/NativeSelect/NativeSelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ const NativeSelectInput = React.forwardRef(function NativeSelectInput(props, ref
{...other}
/>
{props.multiple ? null : (
<IconComponent className={clsx(classes.icon, classes[`icon${capitalize(variant)}`])} />
<IconComponent
className={clsx(classes.icon, classes[`icon${capitalize(variant)}`], {
[classes.disabled]: disabled,
})}
/>
)}
</React.Fragment>
);
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui/src/Select/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ const SelectInput = React.forwardRef(function SelectInput(props, ref) {
<IconComponent
className={clsx(classes.icon, classes[`icon${capitalize(variant)}`], {
[classes.iconOpen]: open,
[classes.disabled]: disabled,
})}
/>
<Menu
Expand Down

0 comments on commit fb002af

Please sign in to comment.