Skip to content

Commit 74000c8

Browse files
authored
fix: high contrast mode for checkboxes. (#791)
partly resolves #786 This will not work in IE11 or with our legacy build. It must support CSS vars.
1 parent e5b2de9 commit 74000c8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

components/checkbox/skin.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ governing permissions and limitations under the License.
2626

2727
.spectrum-Checkbox-box {
2828
&:before {
29+
forced-color-adjust: none;
2930
border-color: var(--spectrum-checkbox-emphasized-box-border-color);
3031
background-color: var(--spectrum-checkbox-emphasized-box-background-color);
3132
}
@@ -97,6 +98,7 @@ governing permissions and limitations under the License.
9798
}
9899

99100
&:disabled ~ .spectrum-Checkbox-label {
101+
forced-color-adjust: none;
100102
color: var(--spectrum-checkbox-text-color-disabled);
101103
}
102104
}
@@ -206,3 +208,36 @@ governing permissions and limitations under the License.
206208
}
207209
}
208210
}
211+
212+
@media (forced-colors: active) {
213+
.spectrum-Checkbox-input {
214+
&:focus-ring + .spectrum-Checkbox-box {
215+
forced-color-adjust: none;
216+
outline-color: var(--spectrum-checkbox-focus-ring-color-key-focus);
217+
outline-style: auto;
218+
outline-offset: var(--spectrum-checkbox-focus-ring-gap-key-focus);
219+
outline-width: var(--spectrum-checkbox-focus-ring-size-key-focus); }
220+
}
221+
:root {
222+
--spectrum-checkbox-emphasized-box-background-color : var(--spectrum-alias-background-color-transparent);
223+
--spectrum-checkbox-emphasized-box-background-color-disabled : var(--spectrum-alias-background-color-transparent);
224+
--spectrum-checkbox-emphasized-box-border-color-disabled : GrayText;
225+
--spectrum-checkbox-text-color-disabled : GrayText;
226+
--spectrum-checkbox-box-border-color-key-focus: FieldText;
227+
--spectrum-checkbox-emphasized-box-border-color: FieldText;
228+
--spectrum-checkbox-quiet-box-border-color: FieldText;
229+
--spectrum-checkbox-box-border-color-selected-hover : Highlight;
230+
--spectrum-checkbox-emphasized-box-border-color-selected-hover : Highlight;
231+
--spectrum-checkbox-quiet-box-border-color-selected-hover : Highlight;
232+
--spectrum-checkbox-emphasized-box-border-color-selected: Highlight;
233+
--spectrum-checkbox-quiet-box-border-color-selected: Highlight;
234+
--spectrum-checkbox-checkmark-color: HighlightText;
235+
--spectrum-checkbox-focus-ring-color-key-focus: Highlight;
236+
--spectrum-checkbox-focus-ring-gap-key-focus: var(--spectrum-global-dimension-static-size-25);
237+
--spectrum-checkbox-focus-ring-size-key-focus: var(--spectrum-global-dimension-static-size-40);
238+
--spectrum-checkbox-box-border-color-error: FieldText;
239+
--spectrum-checkbox-box-border-color-error-hover: FieldText;
240+
--spectrum-checkbox-box-border-color-error-selected: FieldText;
241+
--spectrum-checkbox-text-color-error: FieldText;
242+
}
243+
}

0 commit comments

Comments
 (0)