A11y | Use an offset focus outline on MCQ options - #73
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughMCQ checkbox and radio inputs now span the full option card while remaining visually hidden. The native input outline is removed. Focused options now use a 2px solid Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue was identified. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
Summary
Fixes CodeSignal/learn#4490. MCQ radio and checkbox options now draw a 2px keyboard focus outline, held 2px off the card, in
--Colors-Input-Focus-Visible. Offsetting it against the page is what lets one color cover unchecked, checked, and hover.The native inputs were 0×0, so Chromium skipped them when tabbing. They now fill the option (still invisible) so Tab and arrows can land on them.
Changes
.mcq-option:has(input:focus-visible)is the composite-control companion to the design-system radio/checkbox ring:position: relative, 2px solid, 2px offset, no z-index. We ring the whole card because the 26px mark sits on the card fill; an offset there would contrast against the card, not the page.The two-tone box-shadow ring is gone. Mouse clicks stay on
:focus-visibleand do not draw the outline. Hover and checked borders are unchanged.Test plan
npm test— characterization locks the 2px offset outline, no box-shadow, and the stretched input/playwithmcq.md: Tab to a radio and confirm a 2px primary outline 2px off the card in light and dark/playwithmcq-multi-answer.md: same ring on checkboxes