Skip to content

fix(website): keep keyboard focus on artifact frame recovery buttons - #33706

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/artifact-frame-retry-keeps-focus
Nov 9, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/artifact-frame-retry-keeps-focus

Conversation

@chenmingwei23

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A keyboard user keeps focus on an artifact frame's recovery button while the frame re-renders, instead of being dropped to the page.

The Retry and Show artifact buttons on an artifact frame take a native disabled while the re-mint runs. A disabled button leaves the tab order, so pressing one from the keyboard drops focus to the page the moment the busy state turns on, and focus stays lost if the re-mint rejects.

Why it matters

A keyboard or screen-reader user who presses Retry to recover a frame that failed to render loses their place entirely: focus falls to the document body with no announcement, so recovering an artifact is the exact moment the page becomes hardest to navigate without a mouse.

Not a goal

  • No change to the recovery behaviour itself (what Retry / Show artifact do, the notice copy, the re-mint logic) beyond keeping focus and ignoring a duplicate press.
  • No shared-button-component refactor; only the three recovery buttons the bug names.

What changed (motivation -> approach -> change)

Symptom: a keyboard press of Retry / Show artifact drops focus to the page while the frame re-renders. Root cause: the busy state is signalled with a native disabled, which removes the button from the tab order, so the browser moves focus off it. Fix: signal busy with aria-disabled and aria-busy instead, which keep the button focusable, and add a if (!pending) ... guard so a second press while busy is ignored. This mirrors the pattern the remote artifact Fork button already uses. The busy look is unchanged: the aria-disabled: utility classes repeat the default Btn disabled styling (opacity-30, cursor-not-allowed, no active scale).

Sites changed:

  • website/src/pages/RemoteArtifactDetailPage.tsx - the in-flow Retry button in the failed branch, and the Retry / Show artifact button in the recovery overlay.
  • website/src/components/ArtifactBody.tsx - the Retry / Show artifact button in the frame's recovery overlay.

Backwards compatibility

Removes nothing: no field, validator, kind, key or public function changes; this only swaps how a button's busy state is expressed in the DOM.

Tests

Added a focus test to website/src/test/RemoteArtifactDetailPage.silentLoad.test.tsx (overlay recovery button stays aria-disabled + aria-busy, not native-disabled, keeps document.activeElement, and ignores a second press while busy) and updated the two ArtifactBody.iframeBlob.test.tsx tests that pinned the old native-disabled acknowledgement to assert the new aria-disabled/aria-busy busy state. All touched vitest files pass (84/84), tsc clean, eslint --max-warnings 0 clean.

Proof: PROVEN - reverting the production hunks reds the overlay focus test (the busy button has no aria-disabled); re-applying greens it (head 2a5b127). prove.py not run: frontend test (prove.py runs Python only).

Manual verification

N/A - unit coverage asserts the focus-retaining busy state and the duplicate-press guard directly through the component.

Screenshots / video

Why no screenshot: The busy state's appearance is unchanged - the aria-disabled: utility classes reproduce the default Btn disabled styling exactly (opacity-30, cursor-not-allowed, no active scale); only the DOM attribute carrying that state changed (disabled -> aria-disabled/aria-busy), which has no rendered delta.

Related Issues

Closes #33398

Sibling sweep

Swept: git grep -nE "disabled=\{pending\}" -- website/src across the artifact surfaces.
Sibling: website/src/pages/RemoteArtifactDetailPage.tsx (both recovery buttons) -- changed here.
Sibling: website/src/components/ArtifactBody.tsx -- changed here.
Siblings: the remote artifact Fork button was already fixed on main with this same pattern; no other disabled={pending} recovery button remains in the artifact frame surfaces.

Pattern harvest

Rule candidate: review-prompt
Pattern: a button that stays mounted while busy must signal busy with aria-disabled/aria-busy (plus a press guard), not native disabled, or it leaves the tab order and drops keyboard focus.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) - N/A
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Applies the established aria-disabled busy pattern to the remaining artifact recovery buttons. The busy look is reproduced, so there is no visual change to show.

Notes

  • This hand-written triple (aria-disabled: classes + aria-busy + an if (!pending) guard) now appears in about 50 files. A follow-up should move it into a busy prop on Btn so the next native-disabled site doesn't come back.

[DESIGN-REVIEWED] 039c8cd

Description read

[DESCRIPTION-READ] 1ac84f34f05d103b37045114213f63366a96b4080997fc88f2aa475ecd095a02

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 039c8cd0fab2158c0d5dc93361a9b23154f5e18e — 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

This fixes the focus bug on the three buttons named in #33398. It is a point patch: the same busy-as-native-disabled pattern appears in many other places and is left alone.

Notes

  • Item 1 — symptom-level: the fix swaps disabled={pending} for aria-disabled plus a press guard, one button at a time. The cause is the shared core Btn in website/src/components/ui.tsx:71, which has no busy state, so every busy button falls back to native disabled. Grepping disabled=\{(pending|busy|[a-zA-Z.]*isPending)\} in website/src/**/*.tsx finds 314 matches in 149 files, and this PR fixes 3 of them. Some may be buttons that unmount while busy, which don't lose focus the same way. ## Not a goal excludes the shared fix ("No shared-button-component refactor"), so it is accepted and deferred. Subtraction: keep this PR to the three sites and defer the sweep to its own change.

What this change ships

Inventory (5 items) — 5 justified

Intent: a keyboard user who presses Retry or Show artifact on a failed frame keeps focus while the frame re-renders. FIX.

  1. Retry / Show artifact in the artifact frame's recovery overlay keeps focus while busy — justified
  2. The in-flow Retry on the remote artifact page keeps focus while busy — justified
  3. Retry / Show artifact in the remote artifact page's overlay keeps focus while busy — justified
  4. Busy recovery buttons tell screen readers they are busy (aria-busy) — justified
  5. A second press while busy does nothing, and the busy look is unchanged — justified

[FIRST-PRINCIPLES-REVIEWED] 039c8cd

Description read

[DESCRIPTION-READ] 2c294731f5a9b0aa549d2755315b59d2411d63779f784171b7418a3aa138d7f4

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check. The busy state looks the same as before: the aria-disabled: classes copy Btn's default disabled:opacity-30 disabled:cursor-not-allowed. The only change a user notices is that keyboard focus now stays on Retry / Show artifact, which is what the PR is for.

[UX-REVIEWED] 039c8cd

Description read

[DESCRIPTION-READ] 1b6bcb9a2c527884d01274191fc83f3f238094779356a22b513adaf6a32a66ab

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 039c8cd

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

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

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 039c8cd

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 039c8cd0fab2158c0d5dc93361a9b23154f5e18e 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 9, 2026
@chenmingwei23
chenmingwei23 force-pushed the fix/artifact-frame-retry-keeps-focus branch from 2a5b127 to 9b32e2c Compare November 9, 2026 05:58
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 9, 2026
The Retry and Show artifact buttons on an artifact frame took a native
`disabled` while the re-mint ran. A disabled button leaves the tab order,
so pressing one from the keyboard dropped focus to the page the moment the
busy state turned on, and it stayed lost if the re-mint rejected.

Each button now stays focusable with `aria-disabled` and `aria-busy` while
the re-mint is in flight, and a guard ignores a second press until it
settles, as the remote fork button already does. The busy look is
unchanged: the `aria-disabled:` classes repeat the default disabled styling.

Covers both Retry/Show artifact buttons in the remote artifact page frame
and the one in the shared ArtifactBody frame.
@chenmingwei23
chenmingwei23 force-pushed the fix/artifact-frame-retry-keeps-focus branch from 9b32e2c to 039c8cd Compare November 9, 2026 07:08
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

F1 fixed in 039c8cd: added an explicit {timeout: 2000} to the iframe-mount waitFor with a comment naming the detail-query to document-mint chain, inside the test grace budget.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 9, 2026
@chenmingwei23
chenmingwei23 marked this pull request as ready for review November 9, 2026 10:48
@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners November 9, 2026 10:48
@chenmingwei23
chenmingwei23 requested a review from Zedmor November 9, 2026 10:48
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 9, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 9, 2026 11:48

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review checked head 039c8cd. All three recovery buttons named in #33398 now stay mounted while pending is true. Each uses aria-disabled and aria-busy instead of native disabled, so keyboard focus stays on the node, and an inline guard ignores a second press. The busy look still matches the old disabled look. The useSandboxDoc contract of not clearing failed at retry start is unchanged. The frontend AUTOSDE rules and the test determinism rules are clean. Reverting the ArtifactBody hunk or the overlay hunk turns the updated tests red.

Done well: the tests pin the real failure mode. They hold the DOM node from before the click, assert it is not natively disabled, and check that a second press does not mint again.

Optional:

  • Main now has a busy prop on Btn (#33667) that sets aria-disabled and aria-busy and drops presses while busy. After a rebase, busy={pending} could replace the hand-written attributes, guards and class strings at all three sites.
  • WidgetFrame.tsx:392 and :423 still use disabled={mintPending} on two recovery buttons. They have the same focus-loss bug and could go in a follow-up issue.
  • No test covers the in-flow Retry in the failed branch of RemoteArtifactDetailPage.tsx:518. Also, happy-dom keeps focus on a natively disabled button, so the activeElement checks cannot fail on main. The test comment could name the attribute assertions as the real pin.

@KiroCrewCaptain
KiroCrewCaptain merged commit 8ff591a into main Nov 9, 2026
102 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/artifact-frame-retry-keeps-focus branch November 9, 2026 11:49
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 9, 2026
bolichen97 pushed a commit that referenced this pull request Nov 9, 2026
…33706)

The Retry and Show artifact buttons on an artifact frame took a native
`disabled` while the re-mint ran. A disabled button leaves the tab order,
so pressing one from the keyboard dropped focus to the page the moment the
busy state turned on, and it stayed lost if the re-mint rejected.

Each button now stays focusable with `aria-disabled` and `aria-busy` while
the re-mint is in flight, and a guard ignores a second press until it
settles, as the remote fork button already does. The busy look is
unchanged: the `aria-disabled:` classes repeat the default disabled styling.

Covers both Retry/Show artifact buttons in the remote artifact page frame
and the one in the shared ArtifactBody frame.

Co-authored-by: kirocrew-agent <agent@kirocrew.local>
(cherry picked from commit 8ff591a)
bolichen97 pushed a commit that referenced this pull request Nov 9, 2026
…33706)

The Retry and Show artifact buttons on an artifact frame took a native
`disabled` while the re-mint ran. A disabled button leaves the tab order,
so pressing one from the keyboard dropped focus to the page the moment the
busy state turned on, and it stayed lost if the re-mint rejected.

Each button now stays focusable with `aria-disabled` and `aria-busy` while
the re-mint is in flight, and a guard ignores a second press until it
settles, as the remote fork button already does. The busy look is
unchanged: the `aria-disabled:` classes repeat the default disabled styling.

Covers both Retry/Show artifact buttons in the remote artifact page frame
and the one in the shared ArtifactBody frame.

Co-authored-by: kirocrew-agent <agent@kirocrew.local>
(cherry picked from commit 8ff591a)
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.

Artifact frames: Retry and Show artifact buttons drop keyboard focus while the frame re-renders

2 participants