Repository navigation
fix(ui): keep Undo available while a toast is focused or hovered - #146940
Conversation
Pause the shared toast expiry budget during pointer hover or focus within, and resume only after both end. Preserve replacement, FIFO, explicit actions, relocation, and cleanup. Co-authored-by: vincentkoc <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 9:12 AM ET / 13:12 UTC (Revision 2). ClawSweeper reviewWhat this changesThe shared Control UI toast pauses automatic dismissal during hover or keyboard focus, resumes the remaining time afterward, and clears queued notifications when removed. Merge readiness✅ Ready for maintainer review The prior shadow-root focus finding is resolved, and no blocking defect remains in the reviewed patch. The fix is still needed on current main; the broader notice redesign does not supersede it. Priority: P2 Review scores
Verification
How this fits togetherControl UI actions send messages and optional recovery callbacks to the shared toast host. That host presents notifications across the app, drawers, and modals, and controls when actions such as Undo disappear. flowchart TD
A[UI action outcome] --> B[Shared toast host]
B --> C[App or modal placement]
C --> D{Hovered or focused?}
D -->|Yes| E[Pause remaining lifetime]
D -->|No| F[Resume expiry timer]
E --> D
F --> G[Dismiss and advance queue]
C --> H[Undo or explicit dismiss]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +54, Tests +271. Total +325 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep interaction-aware expiry in the shared toast owner while preserving caller-owned recovery actions and existing dismissal semantics. Do we have a high-confidence way to reproduce the issue? Yes: current main unconditionally dismisses the toast after six seconds even when Undo holds focus, matching the supplied browser baseline. This review verified the source path without running target code. Is this the best way to solve the issue? Yes: extending the existing timer owner avoids caller-specific timers and preserves the existing Undo mechanism; the updated root-aware focus check resolves the prior review concern. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 060e856e5f9d. 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)
|
Resolve toast focus against its current root during hover exit, render updates, and relocation. Add failing-before shadow-root regressions and retained-focus relocation coverage. Co-authored-by: vincentkoc <[email protected]>
|
Merged via squash.
|
…nclaw#146940) * fix(ui): keep Undo available while a toast is focused or hovered Pause the shared toast expiry budget during pointer hover or focus within, and resume only after both end. Preserve replacement, FIFO, explicit actions, relocation, and cleanup. Co-authored-by: vincentkoc <[email protected]> * fix(ui): preserve focused Undo inside shadow-root modals Resolve toast focus against its current root during hover exit, render updates, and relocation. Add failing-before shadow-root regressions and retained-focus relocation coverage. Co-authored-by: vincentkoc <[email protected]> --------- Co-authored-by: vincentkoc <[email protected]>



Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Fixes an issue where users lose the archive Undo toast after six seconds even while hovering over it or focusing its action with the keyboard.
Why This Change Was Made
The shared toast owner now pauses its existing expiry timer instead of making every caller manage interaction timing. Focus transfers between toast controls stay paused; explicit actions/dismissal, replacement, FIFO ordering, and modal relocation remain supported. True disconnection clears queued outcomes and timers. Existing archive Undo is unchanged; no new undo mechanism, persistent notification, stacking redesign, or global setting is introduced.
User Impact
Users can pause to read and activate Undo without losing the action or their focus to an automatic timeout. The toast resumes its remaining lifetime only after both pointer hover and keyboard focus leave. No migration or settings changes.
Related: #128270 is the broader operator-notice presentation work. This PR is limited to the current shared toast’s interaction-aware expiry and its regressions; it does not take over that redesign.
Evidence
Baseline: nine existing toast tests passed. Six added interaction/cleanup regressions failed on the unchanged owner (focused Undo expired; hover/focus overlap timed out; replacement ignored retained focus; queued outcome outlived host removal).
After: eighteen toast unit tests passed, including remaining-time precision, both hover/focus exit orders, internal focus transfer, FIFO/replacement, explicit action/dismiss, reduced motion, removed action focus, modal relocation, disconnection cleanup, and hover state reset after removal. Independent review caught the latter; a failing-before/passing-after regression now protects it.
Chromium real-wall-clock component proof: baseline Undo disappeared around 6.6s while focused; fixed Undo remained focused beyond 6.5s and expired only after focus left plus its remaining lifetime. Actual shared toast and production styles with synthetic archive data; not full-app, mock-Gateway, or live-production E2E. Timestamped captures and assertions supplied with this change.
Two existing Chromium toast layout tests passed; 48 archive/annotation caller tests passed.
Changed-check guards, i18n, core-test typecheck, UI typecheck, and dead-export scans passed. The run found four missing test-only braces; those were corrected mechanically, then scoped oxlint (0 warnings/errors), stylelint, formatting, and all 18 toast tests passed.
Independent autoreview: final P0–P2 scope clean after resolving its stale-hover finding. Full application build/live-Gateway proof was not run for this timer-only change.
Before / after
Actual toast component, synthetic archive action, real elapsed time.
After focus leaves, the remaining lifetime resumes and the toast expires normally:
Worked on by: @vincentkoc
Team session