Skip to content

Commit d0cfe34

Browse files
authored
fix: Respond to system HC modes (#4253)
#### Details #3272 calls out some issues in Edge in system HC modes. Upon further investigation, the same problems are also appearing in current production builds of Chrome (detailed status of the change in Chrome can be found [here](https://www.chromestatus.com/feature/5757293075365888#:~:text=Chrome%20Platform%20Status%20Feature%3A%20Forced%20colors%20mode%20Adds,a%20user-chosen%20limited%20color%20palette%20on%20the%20page.)). This PR fixes the specific issues that are called out in Edge, and updates the checks from the Edge-specific flag of `-ms-high-contrast` to the [new standard](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors) of `forced-colors` ##### Motivation Accessibility matters ##### Screenshots The old and new results are identical to both Chrome and Edge Highlights (images are slightly different sizes so scaled slightly differently; the new versions draw the outline using the highlight color and the exclamation point using the highlight text color): HC Mode | Old | New --- | --- | --- None | ![image](https://user-images.githubusercontent.com/45672944/119034715-7f164980-b963-11eb-8e0f-abad45c8e3e8.png) | ![image](https://user-images.githubusercontent.com/45672944/119033656-517cd080-b962-11eb-8f86-ac53ac70ac12.png) HC 1 | ![image](https://user-images.githubusercontent.com/45672944/119033952-b0424a00-b962-11eb-9505-ef7908f7db86.png) | ![image](https://user-images.githubusercontent.com/45672944/119033748-6fe2cc00-b962-11eb-9ac5-d001154fb2f2.png) HC 2 | ![image](https://user-images.githubusercontent.com/45672944/119034097-dbc53480-b962-11eb-8526-651d43ab5b16.png) | ![image](https://user-images.githubusercontent.com/45672944/119034182-f0a1c800-b962-11eb-91dc-aeff0fd1b068.png) HC Black | ![image](https://user-images.githubusercontent.com/45672944/119034292-1038f080-b963-11eb-86ab-c41c88e3fefe.png) | ![image](https://user-images.githubusercontent.com/45672944/119034426-25158400-b963-11eb-8f7c-8615ed27220d.png) HC White | ![image](https://user-images.githubusercontent.com/45672944/119034489-3a8aae00-b963-11eb-86bd-bc72d1f6bfc4.png) | ![image](https://user-images.githubusercontent.com/45672944/119034529-4bd3ba80-b963-11eb-91b6-bfac28d6bf17.png) Buttons HC Mode | Old | New --- | --- | --- None | ![image](https://user-images.githubusercontent.com/45672944/119035251-38751f00-b964-11eb-9afe-690eac0cc2f2.png) | ![image](https://user-images.githubusercontent.com/45672944/119035290-42971d80-b964-11eb-9a65-cbc8ab79f178.png) HC 1 | ![image](https://user-images.githubusercontent.com/45672944/119035403-6490a000-b964-11eb-9e7e-e23df8f907e3.png) | ![image](https://user-images.githubusercontent.com/45672944/119035475-77a37000-b964-11eb-8def-421249074d1a.png) HC 2 | ![image](https://user-images.githubusercontent.com/45672944/119035587-93a71180-b964-11eb-9940-75dfc9fe7758.png) | ![image](https://user-images.githubusercontent.com/45672944/119035705-b9341b00-b964-11eb-8a54-2ee39fb92121.png) HC Black | ![image](https://user-images.githubusercontent.com/45672944/119035804-d2d56280-b964-11eb-999f-95d11394027a.png) | ![image](https://user-images.githubusercontent.com/45672944/119035867-e5e83280-b964-11eb-9b5c-4ba8ef284c97.png) HC White | ![image](https://user-images.githubusercontent.com/45672944/119035915-f7313f00-b964-11eb-99d1-7a3434fade0c.png) | ![image](https://user-images.githubusercontent.com/45672944/119036002-1a5bee80-b965-11eb-829d-f69fb180ff60.png) ##### Context <!-- Are there any parts that you've intentionally left out-of-scope for a later PR to handle? --> I considered making this 2 changes--one to address #3272 and one to switch from `-ms-high-contrast` to `forced-colors`, but kept them in a single PR since it would be strange to fix them just in Edge and leave Chrome broken. <!-- Were there any alternative approaches you considered? What tradeoffs did you consider? --> #### Pull request checklist <!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox --> - [x] Addresses an existing issue: #3272 - [x] Ran `yarn fastpass` - [x] Added/updated relevant unit test(s) (and ran `yarn test`) - [x] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage` - [x] PR title *AND* final merge commit title both start with a semantic tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See `CONTRIBUTING.md`. - [x] (UI changes only) Added screenshots/GIFs to description above - [n/a] (UI changes only) Verified usability with NVDA/JAWS
1 parent 35712fa commit d0cfe34

16 files changed

+54
-28
lines changed

packages/report-e2e-tests/src/examples/axe-results-with-issues.snap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
.ms-Fabric.is-focusVisible .ms-Nav-group .ms-nav-linkButton:focus::after {
133133
border: 1px solid var(--neutral-100);
134134
}
135-
@media screen and (-ms-high-contrast: active) {
135+
@media screen and (forced-colors: active) {
136136
.ms-Fabric.is-focusVisible
137137
.ms-Nav-group
138138
.ms-nav-linkButton:focus::after {
@@ -1038,7 +1038,7 @@
10381038
button.kebab-menu-button--2aa2O svg {
10391039
stroke: var(--primary-text);
10401040
}
1041-
@media screen and (-ms-high-contrast: active) {
1041+
@media screen and (forced-colors: active) {
10421042
button.kebab-menu-button--2aa2O svg {
10431043
fill: inherit !important;
10441044
}

packages/report-e2e-tests/src/examples/axe-results-without-issues.snap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
.ms-Fabric.is-focusVisible .ms-Nav-group .ms-nav-linkButton:focus::after {
133133
border: 1px solid var(--neutral-100);
134134
}
135-
@media screen and (-ms-high-contrast: active) {
135+
@media screen and (forced-colors: active) {
136136
.ms-Fabric.is-focusVisible
137137
.ms-Nav-group
138138
.ms-nav-linkButton:focus::after {
@@ -1038,7 +1038,7 @@
10381038
button.kebab-menu-button--2aa2O svg {
10391039
stroke: var(--primary-text);
10401040
}
1041-
@media screen and (-ms-high-contrast: active) {
1041+
@media screen and (forced-colors: active) {
10421042
button.kebab-menu-button--2aa2O svg {
10431043
fill: inherit !important;
10441044
}

packages/report-e2e-tests/src/examples/combined-results-with-issues.snap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
.ms-Fabric.is-focusVisible .ms-Nav-group .ms-nav-linkButton:focus::after {
133133
border: 1px solid var(--neutral-100);
134134
}
135-
@media screen and (-ms-high-contrast: active) {
135+
@media screen and (forced-colors: active) {
136136
.ms-Fabric.is-focusVisible
137137
.ms-Nav-group
138138
.ms-nav-linkButton:focus::after {
@@ -1038,7 +1038,7 @@
10381038
button.kebab-menu-button--2aa2O svg {
10391039
stroke: var(--primary-text);
10401040
}
1041-
@media screen and (-ms-high-contrast: active) {
1041+
@media screen and (forced-colors: active) {
10421042
button.kebab-menu-button--2aa2O svg {
10431043
fill: inherit !important;
10441044
}

packages/report-e2e-tests/src/examples/combined-results-without-issues.snap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
.ms-Fabric.is-focusVisible .ms-Nav-group .ms-nav-linkButton:focus::after {
133133
border: 1px solid var(--neutral-100);
134134
}
135-
@media screen and (-ms-high-contrast: active) {
135+
@media screen and (forced-colors: active) {
136136
.ms-Fabric.is-focusVisible
137137
.ms-Nav-group
138138
.ms-nav-linkButton:focus::after {
@@ -1038,7 +1038,7 @@
10381038
button.kebab-menu-button--2aa2O svg {
10391039
stroke: var(--primary-text);
10401040
}
1041-
@media screen and (-ms-high-contrast: active) {
1041+
@media screen and (forced-colors: active) {
10421042
button.kebab-menu-button--2aa2O svg {
10431043
fill: inherit !important;
10441044
}

packages/report-e2e-tests/src/examples/summary-scan-with-issues.snap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
.ms-Fabric.is-focusVisible .ms-Nav-group .ms-nav-linkButton:focus::after {
133133
border: 1px solid var(--neutral-100);
134134
}
135-
@media screen and (-ms-high-contrast: active) {
135+
@media screen and (forced-colors: active) {
136136
.ms-Fabric.is-focusVisible
137137
.ms-Nav-group
138138
.ms-nav-linkButton:focus::after {
@@ -1038,7 +1038,7 @@
10381038
button.kebab-menu-button--2aa2O svg {
10391039
stroke: var(--primary-text);
10401040
}
1041-
@media screen and (-ms-high-contrast: active) {
1041+
@media screen and (forced-colors: active) {
10421042
button.kebab-menu-button--2aa2O svg {
10431043
fill: inherit !important;
10441044
}

packages/report-e2e-tests/src/examples/summary-scan-without-issues.snap.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
.ms-Fabric.is-focusVisible .ms-Nav-group .ms-nav-linkButton:focus::after {
133133
border: 1px solid var(--neutral-100);
134134
}
135-
@media screen and (-ms-high-contrast: active) {
135+
@media screen and (forced-colors: active) {
136136
.ms-Fabric.is-focusVisible
137137
.ms-Nav-group
138138
.ms-nav-linkButton:focus::after {
@@ -1038,7 +1038,7 @@
10381038
button.kebab-menu-button--2aa2O svg {
10391039
stroke: var(--primary-text);
10401040
}
1041-
@media screen and (-ms-high-contrast: active) {
1041+
@media screen and (forced-colors: active) {
10421042
button.kebab-menu-button--2aa2O svg {
10431043
fill: inherit !important;
10441044
}

src/DetailsView/Styles/detailsview.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ body {
5353
.expanded-property-div,
5454
.property-bag-div,
5555
.display-name {
56-
@media screen and (-ms-high-contrast: active) {
56+
@media screen and (forced-colors: active) {
5757
color: highlighttext !important;
5858
}
5959
}

src/DetailsView/components/assessment-instance-details-column.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
.instance-header {
3232
color: $primary-text;
3333
white-space: pre;
34-
@media screen and (-ms-high-contrast: active) {
34+
@media screen and (forced-colors: active) {
3535
color: inherit;
3636
}
3737
}
@@ -40,7 +40,7 @@
4040
white-space: nowrap;
4141
text-overflow: ellipsis;
4242
color: $secondary-text;
43-
@media screen and (-ms-high-contrast: active) {
43+
@media screen and (forced-colors: active) {
4444
color: inherit;
4545
}
4646
}

src/DetailsView/components/assessment-instance-edit-and-remove-control.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
font-size: 16px;
88
line-height: 24px;
99
color: $negative-outcome;
10-
@media screen and (-ms-high-contrast: active) {
10+
@media screen and (forced-colors: active) {
1111
color: inherit;
1212
}
1313
}

src/DetailsView/components/assessment-instance-selected-button.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
.instance-visibility-button {
66
color: $primary-text;
77
padding-bottom: 6px;
8-
@media screen and (-ms-high-contrast: active) {
8+
@media screen and (forced-colors: active) {
99
color: highlighttext !important;
1010
}
1111
}
1212

1313
.instance-visibility-button:focus {
14-
@media screen and (-ms-high-contrast: active) {
14+
@media screen and (forced-colors: active) {
1515
outline: 1px highlighttext solid;
1616
}
1717
}

0 commit comments

Comments
 (0)