Skip to content

Commit

Permalink
Fix disabled Input styles (#21139)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 authored Dec 30, 2021
1 parent 5f0c5c3 commit 4035bf3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/react-input/src/components/Input/useInputStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const useRootStyles = makeStyles({
...shorthands.borderRadius(theme.borderRadiusMedium), // used for all but underline
position: 'relative',
boxSizing: 'border-box',

}),
interactive: theme => ({
// This is all for the bottom focus border.
// It's supposed to be 2px flat all the way across and match the radius of the field's corners.
':after': {
Expand Down Expand Up @@ -121,6 +122,8 @@ const useRootStyles = makeStyles({
backgroundColor: theme.colorNeutralBackground1,
...shorthands.border('1px', 'solid', theme.colorNeutralStroke1),
borderBottomColor: theme.colorNeutralStrokeAccessible,
}),
outlineInteractive: theme => ({
':hover': {
...shorthands.borderColor(theme.colorNeutralStroke1Hover),
borderBottomColor: theme.colorNeutralStrokeAccessibleHover,
Expand All @@ -135,6 +138,8 @@ const useRootStyles = makeStyles({
backgroundColor: theme.colorTransparentBackground,
...shorthands.borderRadius(0), // corners look strange if rounded
...shorthands.borderBottom('1px', 'solid', theme.colorNeutralStrokeAccessible),
}),
underlineInteractive: theme => ({
':hover': {
borderBottomColor: theme.colorNeutralStrokeAccessibleHover,
},
Expand All @@ -147,6 +152,8 @@ const useRootStyles = makeStyles({
filled: theme => ({
boxShadow: theme.shadow2, // optional shadow for filled appearances
...shorthands.border('1px', 'solid', theme.colorTransparentStroke),
}),
filledInteractive: theme => ({
// DO NOT add a space between the selectors! It changes the behavior of make-styles.
':hover,:focus-within': {
// also handles pressed border color (:active)
Expand Down Expand Up @@ -234,6 +241,10 @@ export const useInputStyles = (state: InputState): InputState => {
rootStyles.base,
rootStyles[size],
rootStyles[appearance],
!disabled && rootStyles.interactive,
!disabled && appearance === 'outline' && rootStyles.outlineInteractive,
!disabled && appearance === 'underline' && rootStyles.underlineInteractive,
!disabled && filled && rootStyles.filledInteractive,
state.inline && rootStyles.inline,
filled && rootStyles.filled,
disabled && rootStyles.disabled,
Expand Down

0 comments on commit 4035bf3

Please sign in to comment.