Skip to content

Commit df2b82f

Browse files
tay1orjonesdakahn
andauthored
chore(project): port HCM mixin changes from v11 to v10 (#11330)
* fix(utilities): broaden HCM mixin to include macos query (#10935) * fix(utilities): broaden HCM mixin to include macos query * fix(Utilites): update hcm media query * fix(Utilities): remove prefers-contrast query * fix(RadioButton): update styling to use HCM mixin * chore(project): port HCM mixin changes from v10 to v11 Co-authored-by: DAK <40970507+dakahn@users.noreply.github.com>
1 parent 5286026 commit df2b82f

File tree

4 files changed

+7
-28
lines changed

4 files changed

+7
-28
lines changed

packages/components/src/components/radio-button/_radio-button.scss

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,7 @@
9898
transform: scale(0.5);
9999

100100
// Allow the selected button to be seen in Windows HCM for IE/Edge
101-
@media screen and (-ms-high-contrast: active) {
102-
// Utilize a system color variable to accommodate any user HCM theme
103-
background-color: WindowText;
104-
}
105-
106-
// Firefox only HCM solution
107-
@media screen and (prefers-contrast) {
108-
// Utilize a system color variable to accommodate any user HCM theme
109-
border: 2px solid WindowText;
110-
}
101+
@include high-contrast-mode('icon-fill');
111102
}
112103
}
113104

packages/components/src/globals/scss/_helper-mixins.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,13 @@
252252
}
253253
}
254254

255-
/// Windows HCM Mixin
255+
/// High Contrast Mode mixin for Windows and macOS
256256
/// @access public
257257
/// @example @include high-contrast-mode;
258258
/// @group global-helpers
259259
/// We should set HCM styles at the end of each file to ensure they are not overridden
260260
@mixin high-contrast-mode($type: '') {
261-
@media screen and (-ms-high-contrast: active),
262-
(forced-colors: active),
263-
(prefers-contrast) {
261+
@media screen and (-ms-high-contrast: active), (forced-colors: active) {
264262
@if ($type == 'icon-fill') {
265263
fill: ButtonText;
266264
}

packages/styles/scss/components/radio-button/_radio-button.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@use '../../utilities/focus-outline' as *;
1616
@use '../../utilities/component-reset' as *;
1717
@use '../../utilities/visually-hidden' as *;
18+
@use '../../utilities/high-contrast-mode' as *;
1819
@use '../../utilities/skeleton' as *;
1920
@use '../../utilities/convert' as *;
2021
@use '../../config' as *;
@@ -109,16 +110,7 @@ $radio-border-width: 1px !default;
109110
transform: scale(0.5);
110111

111112
// Allow the selected button to be seen in Windows HCM for IE/Edge
112-
@media screen and (-ms-high-contrast: active) {
113-
// Utilize a system color variable to accommodate any user HCM theme
114-
background-color: WindowText;
115-
}
116-
117-
// Firefox only HCM solution
118-
@media screen and (prefers-contrast) {
119-
// Utilize a system color variable to accommodate any user HCM theme
120-
border: 2px solid WindowText;
121-
}
113+
@include high-contrast-mode('icon-fill');
122114
}
123115
}
124116

packages/styles/scss/utilities/_high-contrast-mode.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
// LICENSE file in the root directory of this source tree.
66
//
77

8-
/// Windows HCM Mixin
8+
/// High Contrast Mode mixin for Windows and macOS
99
/// @access public
1010
/// @example @include high-contrast-mode;
1111
/// @group utilities
1212
/// Set HCM styles at the end of each file to ensure they are not overwritten
1313
@mixin high-contrast-mode($type: '') {
14-
@media screen and (-ms-high-contrast: active),
15-
(forced-colors: active),
16-
(prefers-contrast) {
14+
@media screen and (-ms-high-contrast: active), (forced-colors: active) {
1715
@if ($type == 'icon-fill') {
1816
fill: ButtonText;
1917
}

0 commit comments

Comments
 (0)