Skip to content

Commit

Permalink
fix(a11y): Increase Windows / Firefox HCM support (#6892)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
tw15egan and kodiakhq[bot] committed Sep 24, 2020
1 parent 225f212 commit 17d08e9
Show file tree
Hide file tree
Showing 16 changed files with 165 additions and 13 deletions.
7 changes: 6 additions & 1 deletion config/stylelint-config-carbon/rules/possible-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ module.exports = {
'selector-type-no-unknown': true,

// Media feature
'media-feature-name-no-unknown': true,
'media-feature-name-no-unknown': [
true,
{
ignoreMediaFeatureNames: ['prefers-contrast'],
},
],

// At-rule
'at-rule-no-unknown': OFF,
Expand Down
14 changes: 14 additions & 0 deletions packages/components/src/components/accordion/_accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@
transform: rotate(90deg);
transition: all $duration--fast-02 motion(standard, productive);
fill: $ui-05;

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

.#{$prefix}--accordion__title {
Expand Down Expand Up @@ -160,6 +167,13 @@
/* rtl:ignore */
transform: rotate(-90deg);
fill: $ui-05;

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

Expand Down
18 changes: 18 additions & 0 deletions packages/components/src/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@
.#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--btn--ghost:hover
.#{$prefix}--btn__icon {
fill: $icon-01;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
path {
fill: ButtonText;
}
}
}

.#{$prefix}--btn--ghost.#{$prefix}--btn--icon-only
Expand All @@ -267,6 +276,15 @@
.#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--btn--ghost[disabled]:hover
.#{$prefix}--btn__icon {
fill: $disabled-02;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `GrayText` is a CSS2 system color to help improve colors in HCM
path {
fill: GrayText;
}
}
}

.#{$prefix}--btn--ghost.#{$prefix}--btn--icon-only[disabled] {
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/components/checkbox/_checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@
.#{$prefix}--checkbox-label[data-contained-checkbox-state='mixed'].#{$prefix}--checkbox-label__focus::before {
// Must use box-shadow for appearance of multiple borders with rounded corners.
box-shadow: 0 0 0 2px $inverse-01, 0 0 0 4px $focus;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `highlightText` is a CSS2 system color to help improve colors in HCM
outline: 1px solid highlightText;
outline-offset: 2px;
}
}

//----------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@
transition: transform $duration--moderate-01 motion(standard, productive);
fill: $ui-05;

// Windows HCM fix
@media screen and (-ms-high-contrast: active) {
// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
fill: ButtonText;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@
fill: $ui-05;
}

// Windows HCM fix
// Windows, Firefox HCM Fix
.#{$prefix}--table-sort__icon,
.#{$prefix}--table-sort__icon-unsorted {
@media screen and (-ms-high-contrast: active) {
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
fill: ButtonText;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/components/src/components/dropdown/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@

padding: 0 rem(48px) 0 rem(16px);
text-align: left;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
border: 1px solid transparent;
}
}

.#{$prefix}--dropdown--xl {
Expand Down
35 changes: 35 additions & 0 deletions packages/components/src/components/list-box/_list-box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ $list-box-menu-width: rem(300px);

.#{$prefix}--list-box--disabled .#{$prefix}--list-box__menu-icon > svg {
fill: $disabled-02;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `GrayText` is a CSS2 system color to help improve colors in HCM
fill: GrayText;
}
}

.#{$prefix}--list-box--disabled,
Expand Down Expand Up @@ -356,6 +363,13 @@ $list-box-menu-width: rem(300px);
.#{$prefix}--list-box__menu-icon > svg {
height: 100%;
fill: $icon-01;

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

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

.#{$prefix}--list-box__selection > svg {
fill: $icon-02;

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

.#{$prefix}--list-box--disabled .#{$prefix}--list-box__selection:focus {
Expand Down Expand Up @@ -424,6 +445,13 @@ $list-box-menu-width: rem(300px);
background-color: $hover-secondary;
border-radius: 50%;
}

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

.#{$prefix}--list-box--disabled
Expand All @@ -434,6 +462,13 @@ $list-box-menu-width: rem(300px);
&:hover {
background-color: initial;
}

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `GrayText` is a CSS2 system color to help improve colors in HCM
fill: GrayText;
}
}

.#{$prefix}--list-box__selection--multi:focus,
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/components/modal/_modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@
width: rem(20px);
height: rem(20px);
fill: $icon-01;

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

.#{$prefix}--body--with-modal-open {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@
height: rem(16px);
fill: $icon-01;

// Windows HCM fix
@media screen and (-ms-high-contrast: active) {
// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
fill: ButtonText;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ $css--helpers: true;
transition: outline $duration--fast-02 motion(standard, productive),
background-color $duration--fast-02 motion(standard, productive);
fill: $ui-05;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
border: 1px solid transparent;
}
}

.#{$prefix}--pagination__button:focus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@
// Allow the selected button to be seen in Windows HCM for IE/Edge
@media screen and (-ms-high-contrast: active) {
// Utilize a system color variable to accomodate any user HCM theme
background-color: windowText;
background-color: WindowText;
}

// Firefox only HCM solution
@media screen and (prefers-contrast) {
// Utilize a system color variable to accomodate any user HCM theme
border: 2px solid WindowText;
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions packages/components/src/components/search/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@
pointer-events: none;
fill: $icon-02;

// Windows HCM fix
@media screen and (-ms-high-contrast: active) {
// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
fill: ButtonText;
}
Expand Down Expand Up @@ -170,6 +171,12 @@

.#{$prefix}--search-close svg {
fill: inherit;

// Firefox HCM Fix
@media screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
fill: ButtonText;
}
}

.#{$prefix}--search-close,
Expand Down
9 changes: 9 additions & 0 deletions packages/components/src/components/select/_select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@
height: 100%;
pointer-events: none;
fill: $ui-05;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
path {
fill: ButtonText;
}
}
}

.#{$prefix}--select-input__wrapper[data-invalid]
Expand Down
21 changes: 21 additions & 0 deletions packages/components/src/components/slider/_slider.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
background: $ui-03;
transform: translate(0%, -50%);
cursor: pointer;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
border: 1px solid transparent;
}
}

.#{$prefix}--slider__track:before {
Expand All @@ -75,6 +82,13 @@
transform-origin: left;
transition: background $duration--fast-02 motion(standard, productive);
pointer-events: none;

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
border: 1px solid transparent;
}
}

.#{$prefix}--slider__thumb {
Expand Down Expand Up @@ -109,6 +123,13 @@
box-shadow: inset 0 0 0 2px $interactive-04;
transform: translate(-50%, -50%) scale(1.4286);
}

// Windows, Firefox HCM Fix
@media screen and (-ms-high-contrast: active),
screen and (prefers-contrast) {
// `ButtonText` is a CSS2 system color to help improve colors in HCM
outline: 1px solid ButtonText;
}
}

.#{$prefix}--slider__input {
Expand Down
12 changes: 9 additions & 3 deletions packages/components/src/globals/scss/_tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@

// IE media query
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
width: rem(208px);
width: auto;
}
// Edge 12-15 and Edge 16 feature queries
@supports (-ms-accelerator: true) {
width: rem(208px);
width: auto;
}
@supports (-ms-ime-align: auto) {
width: rem(208px);
width: auto;
}

// Windows HCM Fix
@media screen and (-ms-high-contrast: active) {
// `GrayText` is a CSS2 system color to help improve colors in HCM
border: 1px solid transparent;
}
}

Expand Down

0 comments on commit 17d08e9

Please sign in to comment.