Skip to content

Commit 7729f9c

Browse files
feat(a11y): improve checkbox accessibility
- Replace `display: none` with visually hidden pattern for checkbox inputs. - Add focus styles (`:focus-visible`) to checkbox visuals. - Ensure keyboard navigation and screen reader support for checkboxes. This fixes the issue where checkboxes were not reachable via keyboard navigation and potentially ignored by screen readers. Co-authored-by: vizzyfreezy <36118637+vizzyfreezy@users.noreply.github.com>
1 parent 2052411 commit 7729f9c

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/components/checkbox/styles.scss

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
align-items: center;
44

55
input {
6-
display: none;
6+
position: absolute;
7+
width: 1px;
8+
height: 1px;
9+
padding: 0;
10+
margin: -1px;
11+
overflow: hidden;
12+
clip: rect(0, 0, 0, 0);
13+
white-space: nowrap;
14+
border: 0;
15+
}
16+
17+
input:focus-visible + .box {
18+
box-shadow: 0 0 0 2px #3399ff;
19+
box-shadow: 0 0 0 2px var(--button-background-color);
720
}
821

922
.box {

0 commit comments

Comments
 (0)