Repository navigation
fix(settings): keep keyboard focus when arming or backing out of Cancel and remove - #29806
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The diff adds and relabels no controls and moves nothing on screen, so no screenshot is needed. The only change is where keyboard focus lands. Notes
[UX-REVIEWED] c089b45 Description read[DESCRIPTION-READ] 41beadb15d0ed827a517162a82963409e4513b55901fdd4622e0831dc3b7dc38 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: a focus handoff local to the component, with no visible change and nothing taken away. Notes
[DESIGN-REVIEWED] c089b45 Description read[DESCRIPTION-READ] 522a89c9797af1f1c9e97d9636d0993727b5140f90d85cab784ab48daef90aaf That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Both behaviour changes fix the reported focus loss (#29799), or the hazard that moving focus creates. Both new tests fail on base. The repo has no focus-handoff helper to reuse: Inventory (3 items) — 3 justifiedIntent: let a keyboard or screen-reader user keep their place while arming or backing out of removing a crew that is still being set up. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] c089b45 Description read[DESCRIPTION-READ] da7a6480981daa5fd5dddf3a84898c08dbac5bbd79081409e6d0fe6314d46eb6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
[operator: bolichen97] Approving at head c089b45.
Hooks sit before the early return, Btn forwards ref and onKeyDown, and focus only moves after a press. The arm-then-confirm flow is unchanged. No blocking issues.
Non-blocking: if cancelling disables the buttons while a focus is pending, .focus() silently does nothing; a short comment on why only Enter repeat is guarded would also help.
AI-assisted, approved by bolichen97
Problem / Motivation
Goal: Keyboard focus stays on the right button when a crew being set up is armed for removal or backed out of.
CancelLaunchBtninwebsite/src/pages/settings/RemoteCrewPanelLaunch.tsxswaps "Cancel and remove the crew…" for "Yes, remove …" plus "Keep setting up", and back again. Each swap unmounts the focused button, so focus falls to the page.Why it matters
The keyboard or screen-reader user loses their place right beside a button that removes a billed crew, and has to find it again before deciding.
Not a goal
RemoteCrewPanelCrewRow.tsx, which has the same shape: open PR fix(instances): stop unmapped transports rendering as SSH #13337 edits that row, and its armed state lives inRemoteCrewPanel.tsx.TailscaleInvites.tsx: open PR fix(shared-crew): one invite entry and one People row per person #29592 rewrites that row.What changed (motivation → approach → change)
After a press arms or disarms the button, an effect moves focus to the button that took the pressed one's place: "Yes, remove …" on arm, "Cancel and remove the crew…" on back-out. Focus only moves after a press, so nothing is stolen on render. A repeated Enter keydown on "Yes, remove …" is ignored, so holding the Enter that armed it cannot also confirm the removal; a fresh press still confirms.
Backwards compatibility
Compatible: the buttons, labels and the arm-then-confirm flow are unchanged; only where focus lands changes, and a held Enter no longer clicks through.
Removes nothing.
Tests
website/src/test/RemoteCrewPanelSigninRecovery.test.tsxadds two cases: focus lands on "Yes, remove …" after arming with Enter and back on the arm button after "Keep setting up"; a repeated Enter on the confirm button is ignored while a fresh press still removes. Both fail on main and pass with the fix.Proof: not provable -- frontend test (prove.py runs Python only)
56 related frontend test files pass (remote crew, instances and settings pages), and so do
tsc -p tsconfig.app.jsonand eslint. Local Opus 5.5 review: PASS. Local GPT 5.6 Sol review (the pinned 6.1 Sol was unavailable) found the held-Enter path; it is fixed here.Manual verification
N/A — unit coverage sufficient: the tests drive the mounted panel with the keyboard.
Screenshots / video
Why no screenshot: nothing on screen changes; only where keyboard focus lands.
Related Issues
Fixes #29799
Sibling sweep
Swept: git grep -nE "const [(armed|confirming[A-Za-z]*), set" -- website/src/pages/settings
Sibling: website/src/pages/settings/RemoteCrewPanelLaunch.tsx -- changed here
Sibling: website/src/pages/settings/TailscaleInvites.tsx -- not affected -- left out because open PR #29592 rewrites this row
Sibling: website/src/pages/settings/AboutPanelUpdateFlow.tsx -- not-in-class -- arms in place on one button, so focus is not lost
Pattern harvest
Rule candidate: none
Pattern: a conditional swap that unmounts the focused button with no focus handoff.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)