Skip to content

Commit 17d08e9

Browse files
fix(a11y): Increase Windows / Firefox HCM support (#6892)
* fix(pagination): high contrast mode fixes * fix(components): address issues in Windows HCM * fix(data-table): add firefox HCM support Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 225f212 commit 17d08e9

File tree

16 files changed

+165
-13
lines changed

16 files changed

+165
-13
lines changed

config/stylelint-config-carbon/rules/possible-errors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ module.exports = {
4747
'selector-type-no-unknown': true,
4848

4949
// Media feature
50-
'media-feature-name-no-unknown': true,
50+
'media-feature-name-no-unknown': [
51+
true,
52+
{
53+
ignoreMediaFeatureNames: ['prefers-contrast'],
54+
},
55+
],
5156

5257
// At-rule
5358
'at-rule-no-unknown': OFF,

packages/components/src/components/accordion/_accordion.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@
8484
transform: rotate(90deg);
8585
transition: all $duration--fast-02 motion(standard, productive);
8686
fill: $ui-05;
87+
88+
// Windows, Firefox HCM Fix
89+
@media screen and (-ms-high-contrast: active),
90+
screen and (prefers-contrast) {
91+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
92+
fill: ButtonText;
93+
}
8794
}
8895

8996
.#{$prefix}--accordion__title {
@@ -160,6 +167,13 @@
160167
/* rtl:ignore */
161168
transform: rotate(-90deg);
162169
fill: $ui-05;
170+
171+
// Windows, Firefox HCM Fix
172+
@media screen and (-ms-high-contrast: active),
173+
screen and (prefers-contrast) {
174+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
175+
fill: ButtonText;
176+
}
163177
}
164178
}
165179

packages/components/src/components/button/_button.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,15 @@
250250
.#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--btn--ghost:hover
251251
.#{$prefix}--btn__icon {
252252
fill: $icon-01;
253+
254+
// Windows, Firefox HCM Fix
255+
@media screen and (-ms-high-contrast: active),
256+
screen and (prefers-contrast) {
257+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
258+
path {
259+
fill: ButtonText;
260+
}
261+
}
253262
}
254263

255264
.#{$prefix}--btn--ghost.#{$prefix}--btn--icon-only
@@ -267,6 +276,15 @@
267276
.#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--btn--ghost[disabled]:hover
268277
.#{$prefix}--btn__icon {
269278
fill: $disabled-02;
279+
280+
// Windows, Firefox HCM Fix
281+
@media screen and (-ms-high-contrast: active),
282+
screen and (prefers-contrast) {
283+
// `GrayText` is a CSS2 system color to help improve colors in HCM
284+
path {
285+
fill: GrayText;
286+
}
287+
}
270288
}
271289

272290
.#{$prefix}--btn--ghost.#{$prefix}--btn--icon-only[disabled] {

packages/components/src/components/checkbox/_checkbox.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@
155155
.#{$prefix}--checkbox-label[data-contained-checkbox-state='mixed'].#{$prefix}--checkbox-label__focus::before {
156156
// Must use box-shadow for appearance of multiple borders with rounded corners.
157157
box-shadow: 0 0 0 2px $inverse-01, 0 0 0 4px $focus;
158+
159+
// Windows, Firefox HCM Fix
160+
@media screen and (-ms-high-contrast: active),
161+
screen and (prefers-contrast) {
162+
// `highlightText` is a CSS2 system color to help improve colors in HCM
163+
outline: 1px solid highlightText;
164+
outline-offset: 2px;
165+
}
158166
}
159167

160168
//----------------------------------------------

packages/components/src/components/data-table/_data-table-expandable.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,9 @@
206206
transition: transform $duration--moderate-01 motion(standard, productive);
207207
fill: $ui-05;
208208

209-
// Windows HCM fix
210-
@media screen and (-ms-high-contrast: active) {
209+
// Windows, Firefox HCM Fix
210+
@media screen and (-ms-high-contrast: active),
211+
screen and (prefers-contrast) {
211212
// `ButtonText` is a CSS2 system color to help improve colors in HCM
212213
fill: ButtonText;
213214
}

packages/components/src/components/data-table/_data-table-sort.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@
150150
fill: $ui-05;
151151
}
152152

153-
// Windows HCM fix
153+
// Windows, Firefox HCM Fix
154154
.#{$prefix}--table-sort__icon,
155155
.#{$prefix}--table-sort__icon-unsorted {
156-
@media screen and (-ms-high-contrast: active) {
156+
@media screen and (-ms-high-contrast: active),
157+
screen and (prefers-contrast) {
157158
// `ButtonText` is a CSS2 system color to help improve colors in HCM
158159
fill: ButtonText;
159160
}

packages/components/src/components/dropdown/_dropdown.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070

7171
padding: 0 rem(48px) 0 rem(16px);
7272
text-align: left;
73+
74+
// Windows, Firefox HCM Fix
75+
@media screen and (-ms-high-contrast: active),
76+
screen and (prefers-contrast) {
77+
border: 1px solid transparent;
78+
}
7379
}
7480

7581
.#{$prefix}--dropdown--xl {

packages/components/src/components/list-box/_list-box.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ $list-box-menu-width: rem(300px);
172172

173173
.#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-icon > svg {
174174
fill: $disabled-02;
175+
176+
// Windows, Firefox HCM Fix
177+
@media screen and (-ms-high-contrast: active),
178+
screen and (prefers-contrast) {
179+
// `GrayText` is a CSS2 system color to help improve colors in HCM
180+
fill: GrayText;
181+
}
175182
}
176183

177184
.#{$prefix}--list-box--disabled,
@@ -356,6 +363,13 @@ $list-box-menu-width: rem(300px);
356363
.#{$prefix}--list-box__menu-icon > svg {
357364
height: 100%;
358365
fill: $icon-01;
366+
367+
// Windows, Firefox HCM Fix
368+
@media screen and (-ms-high-contrast: active),
369+
screen and (prefers-contrast) {
370+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
371+
fill: ButtonText;
372+
}
359373
}
360374

361375
.#{$prefix}--list-box__menu-icon--open {
@@ -385,6 +399,13 @@ $list-box-menu-width: rem(300px);
385399

386400
.#{$prefix}--list-box__selection > svg {
387401
fill: $icon-02;
402+
403+
// Windows, Firefox HCM Fix
404+
@media screen and (-ms-high-contrast: active),
405+
screen and (prefers-contrast) {
406+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
407+
fill: ButtonText;
408+
}
388409
}
389410

390411
.#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection:focus {
@@ -424,6 +445,13 @@ $list-box-menu-width: rem(300px);
424445
background-color: $hover-secondary;
425446
border-radius: 50%;
426447
}
448+
449+
// Windows, Firefox HCM Fix
450+
@media screen and (-ms-high-contrast: active),
451+
screen and (prefers-contrast) {
452+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
453+
fill: ButtonText;
454+
}
427455
}
428456

429457
.#{$prefix}--list-box--disabled
@@ -434,6 +462,13 @@ $list-box-menu-width: rem(300px);
434462
&:hover {
435463
background-color: initial;
436464
}
465+
466+
// Windows, Firefox HCM Fix
467+
@media screen and (-ms-high-contrast: active),
468+
screen and (prefers-contrast) {
469+
// `GrayText` is a CSS2 system color to help improve colors in HCM
470+
fill: GrayText;
471+
}
437472
}
438473

439474
.#{$prefix}--list-box__selection--multi:focus,

packages/components/src/components/modal/_modal.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,13 @@
353353
width: rem(20px);
354354
height: rem(20px);
355355
fill: $icon-01;
356+
357+
// Windows, Firefox HCM Fix
358+
@media screen and (-ms-high-contrast: active),
359+
screen and (prefers-contrast) {
360+
// `ButtonText` is a CSS2 system color to help improve colors in HCM
361+
fill: ButtonText;
362+
}
356363
}
357364

358365
.#{$prefix}--body--with-modal-open {

packages/components/src/components/overflow-menu/_overflow-menu.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@
7575
height: rem(16px);
7676
fill: $icon-01;
7777

78-
// Windows HCM fix
79-
@media screen and (-ms-high-contrast: active) {
78+
// Windows, Firefox HCM Fix
79+
@media screen and (-ms-high-contrast: active),
80+
screen and (prefers-contrast) {
8081
// `ButtonText` is a CSS2 system color to help improve colors in HCM
8182
fill: ButtonText;
8283
}

0 commit comments

Comments
 (0)