Skip to content

fix(settings): keep keyboard focus when arming or backing out of Cancel and remove - #29806

Merged
RohanK6 merged 1 commit into
mainfrom
crew/conductor/cancel-launch-focus
Nov 4, 2026
Merged

RohanK6 merged 1 commit into
mainfrom
crew/conductor/cancel-launch-focus

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Keyboard focus stays on the right button when a crew being set up is armed for removal or backed out of.

CancelLaunchBtn in website/src/pages/settings/RemoteCrewPanelLaunch.tsx swaps "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

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.tsx adds 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.json and 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 4, 2026 17:09
@RohanK6
RohanK6 requested a review from buluoray November 4, 2026 17:09
@RohanK6
RohanK6 enabled auto-merge (squash) November 4, 2026 17:09
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of c089b45f5bc8beb3240a46d97ff2da3cf11cc774 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • After arming, focus lands on the destructive "Yes, remove …" rather than "Keep setting up". Two separate Enter presses now remove a billed crew, where before the second press did nothing. Focusing "Keep setting up" on arm would make removal a deliberate Tab plus Enter.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of c089b45f5bc8beb3240a46d97ff2da3cf11cc774 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c089b45f5bc8beb3240a46d97ff2da3cf11cc774 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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: useArmedDelete in website/src/hooks/useArmedDelete.ts does not manage focus.

Inventory (3 items) — 3 justified

Intent: 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.

  1. Arming with "Cancel and remove the crew…" now puts focus on "Yes, remove …" instead of dropping it to the page. — justified
  2. Pressing "Keep setting up" now puts focus back on "Cancel and remove the crew…". — justified
  3. Holding down the Enter that armed the button no longer confirms the removal; confirming takes a fresh press. — justified

[FIRST-PRINCIPLES-REVIEWED] c089b45

Description read

[DESCRIPTION-READ] da7a6480981daa5fd5dddf3a84898c08dbac5bbd79081409e6d0fe6314d46eb6

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed c089b45f5bc8beb3240a46d97ff2da3cf11cc774 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c089b45

Verdict parsed from the review's SHA-scoped output markers for commit c089b45f5bc8beb3240a46d97ff2da3cf11cc774.

False positive or not applicable? A repository writer can comment:
/ai-review override fable c089b45f5bc8beb3240a46d97ff2da3cf11cc774 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of c089b45f5bc8beb3240a46d97ff2da3cf11cc774 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c089b45

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c089b45f5bc8beb3240a46d97ff2da3cf11cc774 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 4, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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

@RohanK6
RohanK6 merged commit ea6d424 into main Nov 4, 2026
151 of 157 checks passed
@RohanK6
RohanK6 deleted the crew/conductor/cancel-launch-focus branch November 4, 2026 20:40
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 4, 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.

Remote crew setup: Cancel and remove drops keyboard focus when armed or backed out

2 participants