Skip to content

fix(ui): keep typing focus when the GitHub reader opens - #157202

Merged
steipete merged 2 commits into
mainfrom
codex/github-sidebar-focus
Sep 24, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/github-sidebar-focus

Conversation

@steipete

@steipete steipete commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the native GitHub side panel stealing keyboard focus when it opens or finishes loading after the user has returned to typing in chat.

User Impact

Users can keep typing while a GitHub document opens, loads, or fails. Explicitly creating a new reader tab still focuses its address bar. Document navigation and comment scrolling remain available.

Why This Change Was Made

The shared link reader repeatedly focused its content until a successful response arrived; failures left that focus request active indefinitely. Its implicit embedded tab also focused an empty address bar before receiving the pending URL. Document positioning now uses a scroll-only intent, and implicit mounting leaves keyboard focus alone.

Evidence

  • Both new embedded/standalone regressions fail on the original implementation and pass after the fix. They cover opening, delayed completion, errors, and editing the address after an error; existing new-tab coverage now checks address focus.
  • 66 focused reader, routing, and content tests passed. The changed reader test file alone passed 32 tests in 24.56 seconds runner wall time (20.94 seconds Vitest duration; about 1.5 seconds test execution) with pnpm test ui/src/components/link-reader-panel.test.ts --maxWorkers=1.
  • Real Chrome, actual Control UI app and intercepted GitHub link route with a synthetic mock Gateway: the original code moved focus to .lr-content after loading. The fix kept the composer active through delayed module mounting and detail completion, receiving the complete text Keep typing through opening and loading. Deferred failure also preserves typing.
  • Independent Codex review found no actionable P0–P2 findings. Changed-scope checks passed, including UI and six affected test typecheck graphs, lint/stylelint, formatting, i18n, unused exports, and repository guards. Ordinary PR CI passed on corrected head 04925b2d391e3a9971f7186dbb1d3bbeb8d5fb4f: run 36004199202.
  • This changes keyboard focus behavior, with no layout or styling changes. Browser evidence uses synthetic GitHub responses; it does not exercise a production Gateway or authenticated GitHub API.

CI follow-up

The first CI attempt was intentionally deferred while Full Release Validation held runner priority. After that hold cleared, run 35985705750 attempt 2 passed all selected checks except an unrelated image-handoff E2E assertion: it counted a temporary animation class after the 180 ms animation could already have finished. Commit 03405c36ecad had intentionally made animation completion remove that class. This PR removes the stale duplicate assertion; the image payload, loaded-image frame continuity, stable row identity, and authoritative-history handoff assertions remain intact. Dedicated browser motion tests record actual animation events, and lifecycle unit tests protect cleanup and no replay.

The original 79-file shard was replayed locally with the CI include list and shard selection. Its image test passed, but two unrelated microphone-lifetime cases remained in connecting; both also fail alone locally and both passed in hosted CI. Captured diagnostics show native microphone acquisition remained pending before any provider session creation, with a connected Gateway and no browser errors. The local cause remains unproven; this is not claimed as passing proof. No microphone code or assertions changed.

After the cleanup: all eight image-handoff/motion browser cases and all eight animation lifecycle tests passed. The changed image-handoff file alone passed all five cases in 21.87 seconds runner wall time (20.02 seconds Vitest duration). Its original CI file cost was 26.826 seconds. The correction passed fresh independent P0–P2 review and all selected changed-file checks.

Recovery-run limits

GitHub returned startup_failure for the corrected head before creating ordinary PR CI jobs. The native manual recovery run 35998578972 selected the full repository suite. Its runtime-topology job received a runner shutdown signal; the advisory SDK-diff report failed with a DataView bounds error; a Windows ACP argv case exceeded its unchanged 5000 ms startup budget. That timeout covers lease-store admission, process launch, ACP initialization, and Windows descendant discovery, so the log cannot identify the blocked stage. All three unleased command variants passed. Read-only source/history investigation found no safe bounded repair; no budgets, assertions, mocks, dependencies, or ACP behavior were changed. These broader diagnostic failures remain recorded here. The ordinary PR run was restored through a draft-to-ready transition on the same PR and head, and passed all selected gates without changing their scope or assertions.

Hosted test cost on the final ordinary PR run: the 32 reader unit cases used 1.947 seconds of test execution; the five image-handoff E2E cases passed in 15.208 seconds.

Keep document opening, loading, and navigation passive while preserving scroll-to-comment behavior and explicit new-tab address focus. Cover embedded and standalone opening, delayed responses, errors, and address editing.
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 24, 2026 10:10
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 9:48 AM ET / 13:48 UTC (Revision 4).

ClawSweeper review

What this changes

The PR makes the Control UI link reader preserve typing focus while documents open, load, or fail, adds focus tests and documentation, and removes a stale animation assertion.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still has the reported focus theft, and this coherent PR provides a distinct fix. No blocking patch defect was found.

Priority: P2
Reviewed head: 04925b2d391e3a9971f7186dbb1d3bbeb8d5fb4f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused patch and regression coverage are strong, with specific real-browser results reported but no linked capture to inspect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body reports a real Chrome Control UI run through an intercepted GitHub link and synthetic mock Gateway: after the reader fix, the composer retained focus and accepted typing through delayed document completion and failure. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body reports a real Chrome Control UI run through an intercepted GitHub link and synthetic mock Gateway: after the reader fix, the composer retained focus and accepted typing through delayed document completion and failure. No stored-data contract changes.
Evidence reviewed 7 items Current main still steals focus: Comparing the pinned PR head with current main shows that main retains the reader's content.focus() call during updates, including while a detail request is pending.
Reader behavior in the proposed head: The reader now scrolls ready content without focusing it; implicit embedded-tab creation suppresses address focus, while an explicitly created empty tab retains address focus.
Production entry point: Supported chat links dispatch a reader-panel request, connecting the reported click flow to the changed component.
Findings None None.
Security None None.

How this fits together

The Control UI routes supported links from chat into a reader panel, which requests document details through the Gateway and renders them beside the conversation. The panel also controls scrolling and keyboard focus as results arrive.

flowchart LR
 A[Chat link] --> B[Reader tab]
 B --> C[Gateway detail request]
 C --> D{Document loaded?}
 D -->|Yes| E[Render and scroll document]
 D -->|No| F[Show reader error]
 E --> G[Keep typing focus]
 F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests +39, Docs +3. Total +41 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 18 -1
Tests 2 41 2 +39
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 61 20 +41

Review metrics

None.

Technical review

Best possible solution:

Land the reader-owned focus correction while preserving scrolling to document anchors and address focus for explicitly created tabs.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main calls focus() on reader content during updates; opening a supported link while the composer is active reaches that path. The PR body also reports a before-and-after Chrome observation.

Is this the best way to solve the issue?

Yes. The reader owns both focus requests and document positioning, and the patch changes that owner while retaining explicit new-tab address focus.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 34757eb29845.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The reader interrupts typing in a limited Control UI workflow, and the PR provides a focused correction.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body reports a real Chrome Control UI run through an intercepted GitHub link and synthetic mock Gateway: after the reader fix, the composer retained focus and accepted typing through delayed document completion and failure. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports a real Chrome Control UI run through an intercepted GitHub link and synthetic mock Gateway: after the reader fix, the composer retained focus and accepted typing through delayed document completion and failure. No stored-data contract changes.

Evidence

What I checked:

  • Current main still steals focus: Comparing the pinned PR head with current main shows that main retains the reader's content.focus() call during updates, including while a detail request is pending. (ui/src/components/link-reader-panel.ts:248, 34757eb29845)
  • Reader behavior in the proposed head: The reader now scrolls ready content without focusing it; implicit embedded-tab creation suppresses address focus, while an explicitly created empty tab retains address focus. (ui/src/components/link-reader-panel.ts:249, 04925b2d391e)
  • Production entry point: Supported chat links dispatch a reader-panel request, connecting the reported click flow to the changed component. (ui/src/app/link-reader-routing.ts:64, 04925b2d391e)
  • Regression coverage: Added cases check composer focus through opening, delayed completion, and failure in embedded and standalone readers; the existing new-tab case now checks address focus. (ui/src/components/link-reader-panel.test.ts:237, 04925b2d391e)
  • Animation assertion context: The animation owner removes the transient entry class when animation completes, supporting removal of an assertion that counted the class after asynchronous browser work. (ui/src/pages/chat/components/chat-message-entry.ts:110, 04925b2d391e)
  • Real-browser proof reported in PR body: The contributor reports a real Chrome run of the Control UI with an intercepted GitHub link and synthetic mock Gateway: the original reader took focus after loading, while the proposed version kept the composer active through delayed completion and failure. This is a detailed reported observation, without a linked capture to inspect.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-24T10:26:05.341Z sha b69b9b3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T12:23:57.839Z sha 04925b2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T13:36:04.127Z sha 04925b2 :: needs maintainer review before merge. :: none

The 180 ms entry class is retired on animation completion, so counting it after asynchronous browser calls races correct cleanup. Keep image continuity and stable row identity proof; dedicated motion and lifecycle tests own animation behavior.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S labels Sep 24, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 24, 2026
@steipete
steipete enabled auto-merge (squash) September 24, 2026 12:31
@steipete
steipete disabled auto-merge September 24, 2026 13:07
@steipete
steipete marked this pull request as draft September 24, 2026 13:11
@steipete
steipete marked this pull request as ready for review September 24, 2026 13:13
@steipete
steipete merged commit c707fa5 into main Sep 24, 2026
384 of 402 checks passed
@steipete
steipete deleted the codex/github-sidebar-focus branch September 24, 2026 14:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 24, 2026
* commit '9ccfc7d1bea21e34da48edbd54afd2e1be57db40': (89 commits)
  fix(exec): avoid gateway stalls during background task writes (#157177)
  test(cli): isolate preaction title setter state
  fix(test): synchronize Git backoff cancellation readiness (#157315)
  fix: validate Codex model references in Docker (#157175)
  fix(state): tolerate brief WAL coordinator contention (#157121)
  fix: unblock conversations after recovery preparation fails (#157214)
  test(telegram): avoid wall-clock pacing in HTTP conformance (#157281)
  fix: keep independent database work responsive under load (#157230)
  refactor(sqlite): centralize WAL checkpoint execution (#157263)
  improve(android): show tool outcomes in collapsed work (#156950)
  fix: remove tracked release scratch blocking source capture (#157308)
  test(update): remove legacy probe stream ordering race
  fix: preserve steering across reconnects and show queued input (#157135)
  fix(ui): keep typing focus when the GitHub reader opens (#157202)
  fix(ios): keep screenshot logs outside capture evidence
  test(codex): await startup teardown in lifecycle fixtures
  chore(ui): refresh control ui locales (#157311)
  refactor(memory): deslop memory plugins (#156867)
  refactor(test): share CLI diagnostics fixture setup (#157201)
  fix(release): retry notarization submit/wait on transport failures and name the resume command (#157116)
  ...
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
)

* fix(ui): keep typing focus when the GitHub reader opens

Keep document opening, loading, and navigation passive while preserving scroll-to-comment behavior and explicit new-tab address focus. Cover embedded and standalone opening, delayed responses, errors, and address editing.

* test(ui): remove stale image-handoff animation assertion

The 180 ms entry class is retired on animation completion, so counting it after asynchronous browser calls races correct cleanup. Keep image continuity and stable row identity proof; dedicated motion and lifecycle tests own animation behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant