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

checkbox and switch css fixes for high contrast mode #2317

Merged
merged 3 commits into from
Aug 29, 2024
Merged
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
13 changes: 13 additions & 0 deletions packages/components/src/components/checkbox/checkbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ scale-checkbox.indeterminate [part='checkbox'] {
border: none;
color: var(--color-icon-checked-active);
}

@media screen and (forced-colors: active), (-ms-high-contrast: active) {
scale-checkbox.indeterminate [part='checkbox'] {
border: 1px solid;
}
}

scale-checkbox.indeterminate [part='icon'] {
color: var(--color-icon-checked-active);
}
Expand Down Expand Up @@ -256,6 +263,12 @@ scale-checkbox.error [part='checkbox'] {
border: none;
}

@media screen and (forced-colors: active), (-ms-high-contrast: active) {
scale-checkbox.error [part='checkbox'] {
border: 1px solid;
}
}

scale-checkbox.error
[part='input']:focus
~ [part='container']
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/switch/switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ scale-switch scale-icon-action-success {
.switch__toggle {
border: 1px solid;
}
scale-icon-action-checkmark {
scale-switch scale-icon-action-checkmark {
visibility: hidden !important;
}
}
50 changes: 50 additions & 0 deletions packages/components/src/html/checkbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0"
/>
<title>Stencil Component Starter</title>

<script type="module" src="/build/scale-components.esm.js"></script>
<link rel="stylesheet" href="/build/scale-components.css" />
<style type="text/css" media="screen, print">
html {
margin: 0;
padding: 0;
}

body {
margin: 0;
padding: 4rem;
}
</style>
</head>

<body>
<p>
<scale-checkbox
checked
disabled
label="Selected Disabled"
></scale-checkbox>
</p>
<p>
<scale-checkbox indeterminate label="Indeterminate"></scale-checkbox>
</p>
<p>
<scale-checkbox
label="Standard with error"
helper-text="This is the error message"
invalid
></scale-checkbox>
</p>
<p>
<scale-switch
label="My styles were affecting checkbox styles"
></scale-switch>
</p>
</body>
</html>
Loading