Commit 10b9deb
authored
Restore visible focus indicator for keyboard tab navigation (#6938)
Closes #6065.
The blanket `:focus` rule in `public/assets/css/main.css` strips
`outline` and `box-shadow` from anchors, inputs, textareas, buttons,
and the Bootstrap `.btn` family. With both indicators gone, keyboard
users lose all visual feedback while tabbing through forms (the
case-contact form was called out specifically) -- a serious WCAG 2.4.7
"Focus Visible" failure for an app whose users include CASA volunteers
and supervisors who rely on keyboard navigation.
Scope the existing reset to `:focus:not(:focus-visible)` so mouse
click-focus stays clean, and add a sibling `:focus-visible` rule that
draws a 2px outline in the project blue (#4a6cf7) with 2px offset.
Browser support for `:focus-visible` is universal at this point
(Chrome 86+, Firefox 85+, Safari 15.4+); pre-`:focus-visible` browsers
silently fall back to the still-present `:focus` rule.
The `.btn.focus` and `.btn:active`/`.btn.active` selectors are left
on the reset rule because they represent intentional Bootstrap state
classes, not the `:focus` pseudo-class -- they should not gain a focus
ring just for being active.
Other `outline: none` rules (`.select-style-{1,2,3} .select-position
select:focus` at lines 1226/1286/1340) are scoped to selects that get
a `border-color` change as their focus indicator, so they still
communicate focus and are out of scope here.
Tested locally: tabbing through `/cases/.../case_contacts/new` now
shows the blue outline on every input and the submit button; mouse
clicks do not.1 parent 55c9312 commit 10b9deb
1 file changed
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
| |||
0 commit comments