Skip to content

fix: skip hidden controls when trapping focus - #631

Merged
nilbuild merged 2 commits into
nilbuild:masterfrom
febug:fix/hidden-controls-focus-trap
Nov 14, 2026
Merged

nilbuild merged 2 commits into
nilbuild:masterfrom
febug:fix/hidden-controls-focus-trap

Conversation

@yuxino

@yuxino yuxino commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

When a highlighted element contains a visibility: hidden control between two visible buttons, Tab keeps trying to focus the hidden control and never reaches the next button. Shift+Tab gets stuck in the same way.

Check each focus candidate's computed visibility so keyboard navigation skips hidden controls while still reaching an explicitly visible descendant of a hidden parent. The existing pointer-events and layout checks are preserved.

driver-hidden-controls-before-after.mp4

The video is a sequence of actual browser screenshots from a standalone consumer in the official E2E harness. Before the fix, three Tab presses leave focus on First action; afterward, Tab reaches Last action and both directions cycle normally.

The two added regressions fail on the original code and pass with this change. The complete focus suite passes in Chromium, Firefox and WebKit. Unit tests, builds, package lint and formatting also pass.

Validation environment

Node 22.23.2, pnpm 11.9.0, Playwright 1.65.0. Firefox uses the pinned revision 1572; Chromium 1248 and WebKit 2370 are existing runtimes rather than the pinned 1254/2388 revisions. Each engine passed all 17 focus tests; this was not a full E2E-suite run. All 812 unit tests and the three workspace builds passed. Native before/after verification used Chromium 156.

@nilbuild
nilbuild merged commit ebdcfda into nilbuild:master Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants