From 7e2fd1ac6ca4ed1f6a5b921ca0b1e8118b0c650f Mon Sep 17 00:00:00 2001 From: Alona Zherdetska Date: Wed, 18 Dec 2024 07:25:13 +0100 Subject: [PATCH 1/5] feat(utilities): add mixins for high-contrast mode in light and dark themes --- packages/styles/src/mixins/_utilities.scss | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/styles/src/mixins/_utilities.scss b/packages/styles/src/mixins/_utilities.scss index 4eb10fd3a0..71cc9442aa 100644 --- a/packages/styles/src/mixins/_utilities.scss +++ b/packages/styles/src/mixins/_utilities.scss @@ -82,6 +82,20 @@ } } +@mixin high-contrast-mode-dark() { + @media (forced-colors: active) and (prefers-color-scheme: dark), + (-ms-high-contrast: white-on-black) { + @content; + } +} + +@mixin high-contrast-mode-light() { + @media (forced-colors: active) and (prefers-color-scheme: light), + (-ms-high-contrast: black-on-white) { + @content; + } +} + @mixin not-disabled-focus-hover { &:focus, &:not(:disabled):hover, From eb1b9b1e90a96b8aa46dca826d7d68a403b84851 Mon Sep 17 00:00:00 2001 From: Alona Zherdetska Date: Wed, 18 Dec 2024 07:26:51 +0100 Subject: [PATCH 2/5] fix(accessibility): fixed visibility of the arrow-icon in high contrast mode --- packages/styles/src/components/form-select.scss | 13 +++++++++++++ packages/styles/src/mixins/_forms.scss | 3 +++ 2 files changed, 16 insertions(+) diff --git a/packages/styles/src/components/form-select.scss b/packages/styles/src/components/form-select.scss index b557ef2570..915150595d 100644 --- a/packages/styles/src/components/form-select.scss +++ b/packages/styles/src/components/form-select.scss @@ -52,6 +52,10 @@ tokens.$default-map: components.$post-select; @include utilities.high-contrast-mode { border-color: FieldText; } + + @include utilities.high-contrast-mode-dark() { + @include forms.select-bg-image('selected-hcm', $mode: dark); + } } &:hover { @@ -79,6 +83,15 @@ tokens.$default-map: components.$post-select; } } + + @include utilities.high-contrast-mode-light() { + @include forms.select-bg-image('enabled-hcm', $mode: light); + } + + @include utilities.high-contrast-mode-dark() { + @include forms.select-bg-image('enabled-hcm', $mode: dark); + } + &.is-valid, &.is-invalid { &:not(:disabled) { diff --git a/packages/styles/src/mixins/_forms.scss b/packages/styles/src/mixins/_forms.scss index 0854d6adf0..1003563f09 100644 --- a/packages/styles/src/mixins/_forms.scss +++ b/packages/styles/src/mixins/_forms.scss @@ -41,6 +41,9 @@ 'selected-dark': #fff, 'disabled-light': #696864, 'disabled-dark': #fff, + 'enabled-hcm-light': #050400, + 'enabled-hcm-dark': #fff, + 'selected-hcm-dark': #fff, ); @if ($validation == 'valid') { From 7412679be51091a55c1805a06eed95949394d72f Mon Sep 17 00:00:00 2001 From: Alona Zherdetska Date: Wed, 18 Dec 2024 08:53:11 +0100 Subject: [PATCH 3/5] fix(linting): removed redundant spaces --- packages/styles/src/components/form-select.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/styles/src/components/form-select.scss b/packages/styles/src/components/form-select.scss index 915150595d..1e7847a59f 100644 --- a/packages/styles/src/components/form-select.scss +++ b/packages/styles/src/components/form-select.scss @@ -83,7 +83,6 @@ tokens.$default-map: components.$post-select; } } - @include utilities.high-contrast-mode-light() { @include forms.select-bg-image('enabled-hcm', $mode: light); } From 2d25c16f1e3ba8ed2a78008ba967104a63d10ab5 Mon Sep 17 00:00:00 2001 From: Alona Zherdetska Date: Wed, 18 Dec 2024 16:04:55 +0100 Subject: [PATCH 4/5] chore(changeset): added a changeset --- .changeset/famous-panthers-bow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/famous-panthers-bow.md diff --git a/.changeset/famous-panthers-bow.md b/.changeset/famous-panthers-bow.md new file mode 100644 index 0000000000..198c4b0183 --- /dev/null +++ b/.changeset/famous-panthers-bow.md @@ -0,0 +1,5 @@ +--- +'@swisspost/design-system-styles': patch +--- + +Fixed visibility of the arrow-icon in Form Select for HCM. From 26ba2923218f60ae979d0b2f573ce51657e7115d Mon Sep 17 00:00:00 2001 From: Alona Zherdetska Date: Wed, 18 Dec 2024 16:06:05 +0100 Subject: [PATCH 5/5] fix(chnageset): refactored the changeset message --- .changeset/famous-panthers-bow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/famous-panthers-bow.md b/.changeset/famous-panthers-bow.md index 198c4b0183..08534ffdf6 100644 --- a/.changeset/famous-panthers-bow.md +++ b/.changeset/famous-panthers-bow.md @@ -2,4 +2,4 @@ '@swisspost/design-system-styles': patch --- -Fixed visibility of the arrow-icon in Form Select for HCM. +Fixed visibility of the arrow-icon in Form Select for high contrast mode.