feat(bulma-ui): export useFocusTrap, counting the stops the browser's Tab visits #862
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.40) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 298 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.341
Real PR Conversation Timeline
1 comments
"Review active on #862"
general
weight: 0.35
claude[bot]
Closes #772.
An app building its own overlay had to write a focus trap again, though the pickers already had one.
useFocusTrap(ref, { active, initialFocusRef, restoreFocus })moves fromform/_pickerInternalstohelpers/and is exported.restoreFocusalso takes a ref, such as the button that opened a panel.Tab stops match the browser's Tab. The
tabIndexproperty can't tell on its own: it reads -1 for an editable region and an<embed>that Tab visits, and 0 for a<video>without controls that it skips. So a validtabindexattribute decides, and otherwise the element's kind does.href, form controls,<iframe>,<embed>and<object>,<audio>and<video>withcontrols, a<details>summary, and editable regions (once each).<details>' content, and all but one radio of a group.Behaviour.
What changes for the pickers: the old selector counted DateInput's roving day cells, so Tab from the focused day left the popover, and Shift+Tab from the month button landed on a day from another month. Both now wrap, and a DateInput test holds it. TimeInput's first and last stops are unchanged.
The helper page lists the stops and the limits (frames, native date inputs, closed shadow roots, scroll regions), and says a portal inside the trapped container escapes the trap. The matrix credits the Focus trap row, and the custom-component skill points at the hook.
This is the last of three PRs split out of #851, alongside
ClientOnlyandPortal, and closes the issue. They share theindex.tsexport block,PUBLIC_EXPORTS, the comparison data and the generated files.pnpm allpasses locally.