Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(styles): fixed visibility of the arrow-icon in HCM #4325

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/famous-panthers-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Fixed visibility of the arrow-icon in Form Select for high contrast mode.
12 changes: 12 additions & 0 deletions packages/styles/src/components/form-select.scss
Copy link
Contributor

@oliverschuerch oliverschuerch Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dark hc-mode the arrows contrast to the background is really bad.
Default:
image
Hovered:
image

Tested in Chrome 131 on Windows 10.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -79,6 +83,14 @@ 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) {
Expand Down
3 changes: 3 additions & 0 deletions packages/styles/src/mixins/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
14 changes: 14 additions & 0 deletions packages/styles/src/mixins/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading