Skip to content

Commit

Permalink
Dropdown: fix high contrast styles in disabled state (microsoft#14176)
Browse files Browse the repository at this point in the history
* Add high contrast adjust selector to dropdown styles

* Change files

* Change files

* update choicegroup snapshot
  • Loading branch information
tomi-msft committed Jul 23, 2020
1 parent 9f24389 commit c0ba783
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 4 deletions.
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Add high contrast adjust selector to dropdown styles",
"packageName": "@fluentui/react-next",
"email": "ololubek@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-07-23T09:46:38.994Z"
}
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "Add high contrast adjust selector to dropdown styles",
"packageName": "office-ui-fabric-react",
"email": "ololubek@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-07-23T09:05:49.407Z"
}
Expand Up @@ -11,6 +11,7 @@ import {
HighContrastSelectorWhite,
getScreenSelector,
ScreenWidthMinMedium,
getEdgeChromiumNoHighContrastAdjustSelector,
} from '../../Styling';

const GlobalClassNames = {
Expand Down Expand Up @@ -307,7 +308,14 @@ export const getStyles: IStyleFunction<IDropdownStyleProps, IDropdownStyles> = p
border: 'none',
color: semanticColors.disabledText,
cursor: 'default',
selectors: { [HighContrastSelector]: { border: '1px solid GrayText', color: 'GrayText' } },
selectors: {
[HighContrastSelector]: {
border: '1px solid GrayText',
color: 'GrayText',
backgroundColor: 'Window',
},
...getEdgeChromiumNoHighContrastAdjustSelector(),
},
},
],
caretDownWrapper: [
Expand All @@ -326,7 +334,10 @@ export const getStyles: IStyleFunction<IDropdownStyleProps, IDropdownStyles> = p
caretDown: [
globalClassnames.caretDown,
{ color: palette.neutralSecondary, fontSize: fonts.small.fontSize, pointerEvents: 'none' },
disabled && { color: semanticColors.disabledText, selectors: { [HighContrastSelector]: { color: 'GrayText' } } },
disabled && {
color: semanticColors.disabledText,
selectors: { [HighContrastSelector]: { color: 'GrayText' }, ...getEdgeChromiumNoHighContrastAdjustSelector() },
},
],
errorMessage: { color: semanticColors.errorText, ...theme.fonts.small, paddingTop: 5 },
callout: [
Expand Down
Expand Up @@ -316,9 +316,13 @@ exports[`Component Examples renders ChoiceGroup.Custom.Example.tsx correctly 1`]
white-space: nowrap;
}
@media screen and (-ms-high-contrast: active){& {
background-color: Window;
border: 1px solid GrayText;
color: GrayText;
}
@media screen and (forced-colors: active){& {
forced-color-adjust: none;
}
id="Dropdown2-option"
role="option"
>
Expand Down Expand Up @@ -354,6 +358,9 @@ exports[`Component Examples renders ChoiceGroup.Custom.Example.tsx correctly 1`]
@media screen and (-ms-high-contrast: active){& {
color: GrayText;
}
@media screen and (forced-colors: active){& {
forced-color-adjust: none;
}
data-icon-name="ChevronDown"
>
Expand Down
Expand Up @@ -388,9 +388,13 @@ exports[`Component Examples renders Dropdown.Basic.Example.tsx correctly 1`] = `
white-space: nowrap;
}
@media screen and (-ms-high-contrast: active){& {
background-color: Window;
border: 1px solid GrayText;
color: GrayText;
}
@media screen and (forced-colors: active){& {
forced-color-adjust: none;
}
id="Dropdown1-option"
role="option"
>
Expand Down Expand Up @@ -426,6 +430,9 @@ exports[`Component Examples renders Dropdown.Basic.Example.tsx correctly 1`] = `
@media screen and (-ms-high-contrast: active){& {
color: GrayText;
}
@media screen and (forced-colors: active){& {
forced-color-adjust: none;
}
data-icon-name="ChevronDown"
>
Expand Down
15 changes: 13 additions & 2 deletions packages/react-next/src/components/Dropdown/Dropdown.styles.ts
Expand Up @@ -11,6 +11,7 @@ import {
HighContrastSelectorWhite,
getScreenSelector,
ScreenWidthMinMedium,
getEdgeChromiumNoHighContrastAdjustSelector,
} from '../../Styling';

const GlobalClassNames = {
Expand Down Expand Up @@ -307,7 +308,14 @@ export const getStyles: IStyleFunction<IDropdownStyleProps, IDropdownStyles> = p
border: 'none',
color: semanticColors.disabledText,
cursor: 'default',
selectors: { [HighContrastSelector]: { border: '1px solid GrayText', color: 'GrayText' } },
selectors: {
[HighContrastSelector]: {
border: '1px solid GrayText',
color: 'GrayText',
backgroundColor: 'Window',
},
...getEdgeChromiumNoHighContrastAdjustSelector(),
},
},
],
caretDownWrapper: [
Expand All @@ -326,7 +334,10 @@ export const getStyles: IStyleFunction<IDropdownStyleProps, IDropdownStyles> = p
caretDown: [
globalClassnames.caretDown,
{ color: palette.neutralSecondary, fontSize: fonts.small.fontSize, pointerEvents: 'none' },
disabled && { color: semanticColors.disabledText, selectors: { [HighContrastSelector]: { color: 'GrayText' } } },
disabled && {
color: semanticColors.disabledText,
selectors: { [HighContrastSelector]: { color: 'GrayText' }, ...getEdgeChromiumNoHighContrastAdjustSelector() },
},
],
errorMessage: { color: semanticColors.errorText, ...theme.fonts.small, paddingTop: 5 },
callout: [
Expand Down

0 comments on commit c0ba783

Please sign in to comment.