fix(web): check an sr-only checkbox or radio through its own label
AB
2d ago+165+165+012345678901234567890123456789-30-30-01234567890123456789
What and why
- Tailwind's
sr-only(and Bootstrap'svisually-hidden) shrinks a checkbox to one clipped pixel withmargin: -1px. In a label with no left padding, the usual toggle switch, that pixel's centre sits half a pixel outside the label, sopickStandIn(packages/web/src/actions.ts) rejected the label stand-in and Playwright clicked the hidden input:<div class="track"></div> intercepts pointer events. - A pixel-sized control whose centre lands outside its label, or hits nothing, now takes a label the way a boxless control does: the first visible label whose centre is not a link or another control.
controlPointclicks the label's centre for a control centred outside it, so the point read and the point clicked are the same. - On that path a label whose centre nothing hits yet (a dialog with
pointer-events: nonewhile it opens) is read again rather than taken, so a click never lands on a link there that was not checked. The boxless path keeps its current behaviour, so a wrapping or very tall label still works there. - Everything else reads as before: a pixel inside a padded label is still clicked at its own point, a visible pixel-sized input with no visible label is still clicked as itself, and a full-size radio covered from outside its label box is still refused.
I kept the label-box check instead of widening it by a pixel, since still refuses a radio whose label covers it from outside the label box depends on it.
Not covered, and failing on main too: an sr-only control under zoom or transform: scale() (it measures more than a pixel), and one whose label starts with a button, which the half-pixel point hits first.
Issue
Fixes #1744
Verified
Ran it locally: yes
check-actions.test.ts: the 8 newsr-only/visually-hiddencases (check, tap, uncheck, both target kinds) fail on main and pass here. The padded-label-with-a-link, visible one-pixel, link-behind-an-opening-dialog, and wrapping-label cases pass on both, as guards.- Built CLI:
e2eand@e2e-dev/webpacked from main and from this branch, installed into thesr-only-togglerepro,npx e2e run:
| main | this branch |
|---|---|
3 failed: ACTION_FAILED: check did not become actionable in time ... <div class="track"></div> intercepts pointer events | 3 passed (check 972ms, tap 142ms, text-only label 141ms) |
![]() | ![]() |
This branch running check() on the toggle:


