Skip to content

fix(a11y): keep focus on the auto improvement clone button while it runs - #33128

Merged
RohanK6 merged 1 commit into
mainfrom
crew/conductor/auto-improvement-clone-focus
Nov 8, 2026
Merged

RohanK6 merged 1 commit into
mainfrom
crew/conductor/auto-improvement-clone-focus

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A keyboard user who presses Clone in the Auto Improvement setup keeps focus on that button while the clone runs, and one press starts one clone.

In the Auto Improvement setup panel, pressing Clone swaps its label for a spinner and makes it natively disabled until the clone ends (#33102). A disabled button leaves the tab order, so the keyboard user who pressed it loses focus to the page for the whole clone, though the repository step stays on screen. Enter in the URL field during a clone also starts a second clone.

Why it matters

A clone can take a while. A keyboard or screen reader user who starts one loses their place, and a repeated Enter makes the backend run a second clone they did not ask for.

Not a goal

  • No change to the failed-clone message, the current-repo line or the finding Commit buttons: they are deferred to our own issue (see Related Issues).
  • No change to what Clone does or when it is allowed.

What changed (motivation → approach → change)

  • Symptom: focus leaves Clone as soon as it is pressed, and Enter can start a second clone. Cause: disabled={!url.trim() || clone.isPending} on the button, and an Enter handler that checks only the URL.
  • The button and Enter now go through one startClone, which claims the clone in a ref before calling mutate and releases it in onSettled. clone.isPending only flips on the next render, so the ref is what stops a double press in one tick.
  • The busy Clone is aria-disabled instead of disabled, so it keeps focus, and takes the muted look of a disabled primary button with no hover or press effect. An empty URL still disables it.
  • A clone request that failed outright (a dropped connection, or an HTTP error with no body) left nothing on screen once the spinner cleared: only clone.data.error was rendered, never clone.error. Both now render through ErrorNotice, with no hand-off because the typed URL is unsaved (CI review finding on this PR).

Backwards compatibility

Compatible: the same button and label; a busy Clone ignores a press, as before, and now also ignores a repeated Enter.

Removes nothing: no control, label or behaviour is removed.

Tests

website/src/apps/auto-improvement/SetupPanel.coverage.test.tsx "keeps keyboard focus on Clone while the clone runs, and ignores a second press": a double click in one tick, a later click and an Enter in the URL field start one clone; the pressed button stays focused, is aria-disabled and not disabled, and clears once the clone answers. It fails on main, and it also fails with the ref claim removed.
"raises a mutation error when a failed clone returns no error text" now also asserts the failure is announced as an alert.

The 9 Auto Improvement test files pass (89 tests). tsc, eslint and npm run i18n:check are clean. jsdom keeps focus on a disabled button where a browser does not, so the tab-order half is pinned on the attribute.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

N/A — unit coverage sufficient: the test drives the real panel through a held clone and reads the button state, focus and request count.

Screenshots / video

Why no screenshot: the busy Clone looks like a disabled primary button, as it did; the change is that it stays in the tab order, which a still image cannot show.

Related Issues

Fixes #33102

Deferred: #33103

Sibling sweep

Swept: buttons in website/src/apps/auto-improvement disabled from their own in-flight mutation
Sibling: website/src/apps/auto-improvement/SetupPanel.tsx -- changed here (Clone); Run and Stop swap for each other when they succeed, so the pressed one unmounts either way
Sibling: website/src/apps/auto-improvement/AutoImprovementPage.tsx -- tracked in #33103 (finding Commit; open PR #30517 rewrites that flow)

Pattern harvest

Rule candidate: lint
Pattern: a button disabled from its own in-flight mutation while it stays mounted, which drops the focus of the user who pressed it

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

Contribution License Agreement

Contributions are accepted under the project Apache-2.0 license.

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 8, 2026 11:29
@RohanK6
RohanK6 requested a review from Zedmor November 8, 2026 11:29
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

Design-Verdict: PASS

cannot evaluate: missing screenshot of the Clone failure state. The diff swaps the plain warn-text line for an ErrorNotice block and adds a failure state that never rendered before, and the evidence list has no images.

Blockers

The new and restyled clone-error surface has no rendered evidence
Trigger: the diff replaces <p className="text-[12px] text-warn">{clone.data.error}</p> with <ErrorNotice message={clone.data?.error || clone.error?.message} />. It also starts rendering clone.error, which showed nothing before. The description's "no-visual-delta" reason covers only the busy button ("the busy Clone looks like a disabled primary button, as it did").
Outcome: ErrorNotice is a block with an icon, which is not the same as the old small inline warn line → it now sits between the URL row and the "configured" line in a compact setup step → its size, spacing and fit there are a visual change. The design-evidence file lists 0 images and 0 recordings, so that shape cannot be judged.
Fix: attach a screenshot of the setup panel showing the backend refusal (clone.data.error) and the HTTP failure (HTTP 500), and a screenshot of the busy aria-disabled Clone next to a natively disabled primary button.
Clears when: a github.com/user-attachments image of this revision's clone-error state (and the busy Clone styling) appears in the description, or is committed under temp-screenshots/ or .github/screenshots/.

Notes

  • The new aria-disabled: utility string copies a disabled primary button's look one class at a time, inline. If Btn gets a busy prop that applies the same styling, the next "keep focus while pending" fix (the pattern harvest already expects more) won't need another copy.

[DESIGN-REVIEWED] d1b8af2

Description read

[DESCRIPTION-READ] 0fcb833152168b4210133f4bb46792146b10a30f97bd48c238d0dee98c349710

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 8, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of d1b8af241020290a1c6ac320d3f19e44661cc013 — 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. The fix works at the mechanism: one guarded startClone sits behind both entry points, and aria-disabled replaces disabled. The failed-request notice is a declared rider that renders through ErrorNotice, as the convention requires.

Notes

  • Item 3 — duplicate (copied, not shared): the 9-utility aria-disabled: class string copies the primary busy look of website/src/apps/spec-builder/components/shared.tsx:68-69. It can't be imported, because apps don't import across app boundaries, and core Btn (website/src/components/ui.tsx:71) has no busy prop. Subtraction: shrink it to the utilities this button needs once core Btn carries that look.

What this change ships

Inventory (5 items) — 4 justified

Intent: a keyboard user who presses Clone keeps focus while the clone runs, and one press starts one clone. This is a FIX.

  1. Clone keeps keyboard focus and stays in the tab order while a clone runs — justified
  2. A double click, a later click or a repeated Enter during a clone no longer starts a second clone — justified
  3. The busy Clone looks like a muted disabled primary button with no hover or press effect — copied look (see note)
  4. A clone that fails outright (dropped connection, or an HTTP error with no body) now shows an alert instead of nothing — rides along
  5. The backend's clone refusal text now renders as an ErrorNotice alert instead of plain warning text — rides along

[FIRST-PRINCIPLES-REVIEWED] d1b8af2

Description read

[DESCRIPTION-READ] c522683f93e4139e310d9982b9f8988a9c192959c36bd4523422acf1c3401bce

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 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

cannot evaluate: missing a screenshot of the failed-clone error. The PR is marked no-visual-delta, but it swaps the small warn-coloured <p> line for a block ErrorNotice with an icon, and it adds an error state that never rendered before.

Evidence gaps

  • Failed-clone message. {clone.data?.error || clone.error ? <ErrorNotice message={…} /> : null} replaces <p className="text-[12px] text-warn">. The diff changes this message's container, icon and colour, and adds a new case: a request that fails outright (HTTP 500, a dropped connection). The screenshot list is empty and the blind read reports "BLIND READ NOT PERFORMED", so nobody has checked how the notice sits under the URL row. To close the gap, attach a still of the Setup panel after a failed clone (the not a GitHub URL refusal, or HTTP 500).
  • Busy Clone button. Its look now comes from hand-written classes (aria-disabled:bg-bg-hover aria-disabled:text-muted … opacity-60) instead of the native disabled style. The PR says it "looks like a disabled primary button, as it did", but no image shows it. To close the gap, attach a still of Clone with its spinner during a clone, next to the empty-URL disabled state, so the two can be compared.

[UX-REVIEWED] d1b8af2

Description read

[DESCRIPTION-READ] cf679c3467fe9dbc0101f628d8b7272632eff411391b3130322a0367ab52b0f0

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 8, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d1b8af2

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

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d1b8af2

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

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 8, 2026
The setup panel's Clone was natively disabled while the clone ran,
which took it out of the tab order and dropped the focus of the
keyboard user who pressed it, though the repository step stays on
screen. Enter in the URL field could also start a second clone. Mark
the busy Clone with aria-disabled, route the button and Enter through
one start that claims the clone synchronously so a double press in one
tick starts one clone, give the busy state the muted look of a disabled
primary button, and keep disabling it for an empty URL.

A clone request that failed outright left nothing on screen once the
spinner cleared; both that failure and the backend's own refusal now
show through ErrorNotice.
@RohanK6
RohanK6 force-pushed the crew/conductor/auto-improvement-clone-focus branch from 51e8bcf to d1b8af2 Compare November 8, 2026 12:11
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 8, 2026
@RohanK6
RohanK6 enabled auto-merge (squash) November 8, 2026 13:02

@buluoray buluoray 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.

Reviewed head d1b8af2. Clone keeps focus while it runs, and a failure with no error detail still shows a notice, with tests.

@RohanK6
RohanK6 merged commit 48cac3a into main Nov 8, 2026
99 of 115 checks passed
@RohanK6
RohanK6 deleted the crew/conductor/auto-improvement-clone-focus branch November 8, 2026 13:12
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 8, 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.

Approving. In the auto improvement setup panel, the Clone button used to drop keyboard focus while the clone ran. SetupPanel.tsx now keeps it focusable with aria-disabled (still disabled for an empty URL), and a failed clone is announced instead of dropped.

What I checked:

  • Gate: 100 ok, 0 pending. Two checks (Sensitive Change Review and Publish readiness signal) had failed on a GitHub API rate limit; I read both logs, reran each once, and both passed. I then listed the check runs on this head: every remaining red row is an older cancelled or failed run with a newer passing run of the same name.
  • A second press is refused through a ref claimed before mutate, because isPending only changes on the next render. The same startClone serves the button and the Enter key, and the ref is released in onSettled, so it is released after a failure too.
  • The refusal text and a request that failed outright both go through ErrorNotice without the agent hand-off. The comment explains why: the typed repository URL is unsaved and following the hand-off would discard it.
  • The new test covers a double click in one tick, the Enter key during the clone, one call to /setup-clone, focus staying on the button, and the button returning to normal after a refusal. The existing failure test now also checks the alert text.
  • No regex in the added code.

Not checked: I did not run the tests or the panel in a browser.

I did not set auto-merge, because it is already set on this PR.

buluoray added a commit that referenced this pull request Nov 8, 2026
…uns (#33128)

The setup panel's Clone was natively disabled while the clone ran,
which took it out of the tab order and dropped the focus of the
keyboard user who pressed it, though the repository step stays on
screen. Enter in the URL field could also start a second clone. Mark
the busy Clone with aria-disabled, route the button and Enter through
one start that claims the clone synchronously so a double press in one
tick starts one clone, give the busy state the muted look of a disabled
primary button, and keep disabling it for an empty URL.

A clone request that failed outright left nothing on screen once the
spinner cleared; both that failure and the backend's own refusal now
show through ErrorNotice.

Original author: Rohan Khanderia
(cherry picked from commit 48cac3a)
KiroCrewCaptain added a commit to KiroCrewCaptain/kirocrew-app-auto-improvement that referenced this pull request Nov 13, 2026
Ports two wheel-copy fixes of the setup panel.

kirodotdev/KiroCrew#33128: the Clone button stays in the tab order
while a clone runs (aria-disabled instead of disabled), a second press
in the same tick starts no second clone, and a request that fails
outright is announced in an alert.

kirodotdev/KiroCrew#33344: the current-repository line is one message
with a <repo/> slot, translated in all 12 locales, so each language
places the repository name where its word order puts it. The bundle
has no react-i18next, so tSlot in ui/src/i18n.ts renders the slot.

Co-authored-by: KiroCrewCaptain <312312717+KiroCrewCaptain@users.noreply.github.com>
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.

Auto Improvement setup: Clone drops keyboard focus while the clone runs

3 participants