Skip to content

Commit

Permalink
BasePicker: added high contrast styling to SASS file when picker is d…
Browse files Browse the repository at this point in the history
…isabled (#17226)

* updated BasePicker styles to adapt to High Contrast Settings color when disabled

* updated sass file again since original fix stopped working

* Change files

* removed added disabled property
  • Loading branch information
TristanWatanabe authored Mar 2, 2021
1 parent c11994e commit 183f82f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "BasePicker: added high contrast styling to sass file when picker is disabled",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
17 changes: 17 additions & 0 deletions packages/react/src/components/pickers/BasePicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@
border: 2px solid $inputFocusBorderAltColor;
}
}

&.inputDisabled {
@include high-contrast {
position: relative;
border-color: GrayText;
&:after {
pointer-events: none;
content: '';
position: absolute;
left: 0px;
top: 0px;
bottom: 0px;
right: 0px;
background-color: Window;
}
}
}
}

.pickerInput {
Expand Down
10 changes: 8 additions & 2 deletions packages/react/src/components/pickers/BasePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export class BasePicker<T, P extends IBasePickerProps<T>> extends React.Componen
input: css('ms-BasePicker-input', legacyStyles.pickerInput, inputProps && inputProps.className),
screenReaderText: legacyStyles.screenReaderOnly,
};

return (
<div ref={this.root} className={classNames.root} onKeyDown={this.onKeyDown} onBlur={this.onBlur}>
<FocusZone
Expand Down Expand Up @@ -1021,11 +1022,16 @@ export class BasePickerListBelow<T, P extends IBasePickerProps<T>> extends BaseP
})
: {
root: css('ms-BasePicker', className ? className : ''),
text: css('ms-BasePicker-text', legacyStyles.pickerText, this.state.isFocused && legacyStyles.inputFocused),
text: css(
'ms-BasePicker-text',
legacyStyles.pickerText,
this.state.isFocused && legacyStyles.inputFocused,
disabled && legacyStyles.inputDisabled,
),
itemsWrapper: legacyStyles.pickerItems,
input: css('ms-BasePicker-input', legacyStyles.pickerInput, inputProps && inputProps.className),
screenReaderText: legacyStyles.screenReaderOnly,
};

return (
<div ref={this.root} onBlur={this.onBlur}>
<div className={classNames.root} onKeyDown={this.onKeyDown}>
Expand Down

0 comments on commit 183f82f

Please sign in to comment.