Skip to content

Commit

Permalink
A11y: improve input and custom control focus indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
alinekeller authored and williambelle committed May 30, 2024
1 parent d85a466 commit 1a5de18
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 10 additions & 0 deletions assets/components/atoms/checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@
align-items: center;
margin-right: 1rem;
}

.custom-control-input:focus ~ .custom-control-label:before {
box-shadow: none;
outline: 2px solid $gray-600;
outline-offset: 1px;
}

.custom-control-input:checked:focus ~ .custom-control-label:before {
outline-color: $red-dark;
}
8 changes: 5 additions & 3 deletions assets/components/atoms/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
transition:
color 0.3s,
border-color 0.3s,
outline 0.3s,
box-shadow 0.3s;

&:hover,
Expand All @@ -15,9 +14,12 @@
}

&:focus,
&.focus {
&.focus,
&:focus-visible {
border-color: $input-focus-border-color !important;
box-shadow: $input-focus-box-shadow !important;
box-shadow: none !important;
outline: 2px solid $gray-600;
outline-offset: 2px;
}

&.is-invalid {
Expand Down

0 comments on commit 1a5de18

Please sign in to comment.