Repository navigation
fix(ui): stop modal autofocus steal after the open animation - #115168
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 8:25 AM ET / 12:25 UTC. ClawSweeper reviewWhat this changesThe PR prevents the shared web modal component from refocusing its autofocus field after the open animation when a user has already selected another field. Merge readinessThis PR appears to be a focused, correct repair for the shared modal focus race, and the contributor’s refreshed terminal trace supplies after-fix browser and component-test evidence. It remains open because the Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s web UI uses a shared modal wrapper around Web Awesome dialogs; Workboard and other UI surfaces place their form controls inside it. Dialog-show events select an autofocus target, and this change preserves a user’s later in-dialog focus choice after the open animation settles. flowchart LR
A[Modal consumer opens dialog] --> B[Shared modal wrapper]
B --> C[Web Awesome show events]
C --> D[Autofocus selection]
D --> E{Focus already in dialog?}
E -- No --> F[Focus autofocus field]
E -- Yes --> G[Preserve selected field]
F --> H[User edits form]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +17. Total +25 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Merge the shared-dialog guard once a maintainer confirms the final head and required checks, retaining the regression test so future animation timing changes cannot reintroduce focus theft. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the added regression test deterministically focuses the notes field before Is this the best way to solve the issue? Yes. Guarding the shared modal owner boundary is preferable to adding timing waits or test-specific workarounds in each dialog consumer, because it protects user-selected focus across all consumers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4f6fc38a2204. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
385e923 to
2dc590d
Compare
|
Applied both rank-up moves at head 2dc590d7d1512b923f5a378991a814148c11acb9 (rebased onto current Focused terminal trace — modal focus stays on the user-selected field after The regression test dispatches Targeted Workboard browser checks rerun on the refreshed head (Chromium): |
2dc590d to
9706194
Compare
9706194 to
8133833
Compare
|
Merged via squash.
|
* origin/main: fix: preserve skill proposals across apply crashes and workspace moves (#114535) fix(qa): run maturity Docker scenarios through the aggregate scheduler (#114447) refactor(cli): unify configured model rows onto the shared row pipeline (#115239) fix(ui): stop modal autofocus steal after the open animation (#115168) fix(process): preserve long supervisor timeout deadlines (#115230) fix(slack): preserve pasted inbound tables (#115163) fix(codex): restore trajectory capture for canonical session targets (#115220) refactor(qa): make scenario selection taxonomy-owned (#114055) feat(plugins): match shared models across vendor-namespaced catalog ids (#115210)
* origin/main: (150 commits) fix: preserve skill proposals across apply crashes and workspace moves (openclaw#114535) fix(qa): run maturity Docker scenarios through the aggregate scheduler (openclaw#114447) refactor(cli): unify configured model rows onto the shared row pipeline (openclaw#115239) fix(ui): stop modal autofocus steal after the open animation (openclaw#115168) fix(process): preserve long supervisor timeout deadlines (openclaw#115230) fix(slack): preserve pasted inbound tables (openclaw#115163) fix(codex): restore trajectory capture for canonical session targets (openclaw#115220) refactor(qa): make scenario selection taxonomy-owned (openclaw#114055) feat(plugins): match shared models across vendor-namespaced catalog ids (openclaw#115210) fix(ios): forgetting a paired gateway does nothing (openclaw#114083) test(ui): share pauseVirtualClock e2e helper and de-flake marquee hover-delay asserts (openclaw#115203) fix(docs): preserve pure fenced translation chunks (openclaw#115204) fix: keep shared web and TUI chats synchronized under load (openclaw#115191) fix(auto-reply): require a directed turn for the no-visible-reply fallback fix(auto-reply): attest source-routed message-tool sends via the dedupe route matcher fix(auto-reply): attest message-tool source replies in every delivery mode and gate eligibility on resolved settlement fix(auto-reply): bound turn-ledger settlement and treat started sends as conservatively visible fix(auto-reply): abort-aware fallback settlement and straggler drain in turn ledger fix(auto-reply): keep turn-ledger types module-local test(auto-reply): fix type-check errors in turn-ledger corner tests ...
…w#115168) * fix(ui): stop modal autofocus steal after the open animation * test(ui-e2e): give expect.poll a CI-realistic deadline
* origin/main: fix: preserve skill proposals across apply crashes and workspace moves (openclaw#114535) fix(qa): run maturity Docker scenarios through the aggregate scheduler (openclaw#114447) refactor(cli): unify configured model rows onto the shared row pipeline (openclaw#115239) fix(ui): stop modal autofocus steal after the open animation (openclaw#115168) fix(process): preserve long supervisor timeout deadlines (openclaw#115230) fix(slack): preserve pasted inbound tables (openclaw#115163) fix(codex): restore trajectory capture for canonical session targets (openclaw#115220) refactor(qa): make scenario selection taxonomy-owned (openclaw#114055) feat(plugins): match shared models across vendor-namespaced catalog ids (openclaw#115210)
What Problem This Solves
The
checks-ui-e2elane flaked repeatedly on 2026-07-28 (runs 30351573136, 30358455220 attempts 1-4), each time failing exactly one of 104 files, a different test each attempt. Two distinct causes:workboard-status-persistence.e2e.test.tsfailed with the Notes text typed into the Title field (title: "Persisted renamed cardEdited notes survive reopening.",notes: "Original notes").workboard.e2e.test.tsfills the same Edit-card dialog and has flaked identically on other runs.expect.polldeadline. Vitest'sexpect.polldefaults to a 1s timeout; the lane's ~70 polls await real Chromium renders. On loaded runners a route change or list update regularly stalls past 1s, producing rolling one-off failures (external-session-catalogs,new-session-page.workspace-memory,session-management.archive,sidebar-customization— all "Matcher did not succeed in time").Why This Change Was Made
Modal fix:
openclaw-modal-dialogfocused the slotted[autofocus]target twice — once from the scheduledwa-showhook and again onwa-after-show, which fires only after the open animation completes. If focus had already moved to another field inside the dialog (user click, autofill, or Playwrightfill, which focuses + selects in page context and then delivers text through the browser input pipeline), the late refocus stole focus mid-fill and the text landed in the autofocus input at its caret — exactly the concatenation the CI diff shows.handleAfterShownow skips the refocus whendocument.activeElementis already a slotted descendant (excluding the host itself, which is whatactiveElementreports while native dialog chrome holds focus). Fixes every dialog consumer at the owner boundary instead of patching individual tests with waits.Poll budget: the ui-e2e project config now sets
expect: { poll: { interval: 100, timeout: 15_000 } }. Correctness in these tests is the eventual UI state, so a larger deadline only trades failure latency for stability — genuine regressions still fail, 14 seconds later. This mirrors Playwright's own auto-wait budgets (its locator waits in the same suite already use 10-30s).User Impact
Users who click or tab into another field while a dialog's open animation is still settling no longer lose focus (and keystrokes) back to the autofocus field. CI: closes the Workboard edit-dialog corruption flake and the rolling 1s-poll timeout flake class in
checks-ui-e2e.Evidence
node scripts/run-vitest.mjs ui/src/components/modal-dialog.test.ts— 9 passed.node scripts/run-vitest.mjs ui/src/pages/workboard/workboard-status-persistence.e2e.test.ts ui/src/pages/workboard/workboard.e2e.test.ts— 5 passed (Chromium).external-session-catalogs.e2e.test.ts(1 passed),new-session-page.workspace-memory.e2e.test.ts(7 passed).node scripts/check-changed.mjs -- ui/src/components/modal-dialog.ts ui/src/components/modal-dialog.test.ts— 0 warnings, 0 errors (delegated Testbox).gpt-5.6-sol, xhigh) on both changes: clean, no actionable findings (0.94 / 0.98).Companion investigation: the second flake in the original report (
model-catalog-visibility.test.ts120s timeout inagentic-agents-core-models, run 30346551462 attempt 1 at 09:35 UTC) was already fixed by #115139 (merged 10:37 UTC the same day) — synthetic transport tests cold-loading the real OpenAI/Azure provider plugin pushed serial model-catalog tests over the 120s limit. No further change needed for that one.