Skip to content

fix(ui): toasts sit behind a modal's backdrop until pressed, instead of looking live but dead - #36888

Merged
nwparker merged 11 commits into
mainfrom
nwparker/modal-toast-interaction
Nov 1, 2026
Merged

nwparker merged 11 commits into
mainfrom
nwparker/modal-toast-interaction

Conversation

@nwparker

@nwparker nwparker commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​134 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​127
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​294 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​287

Problem

With a modal open (e.g. the "Chat UI is here" dialog), a toast like "An installed Orca skill is out of date — [Update skill]" was drawn above the backdrop and looked interactive, but its action did nothing. #32065 had deliberately locked everything but the close button above modals, while toasts still looked live.

Fix: toasts sit behind the modal's backdrop until you reach for them

  • Older toasts drop behind the backdrop of an open Dialog or Sheet (toaster z-49, under the z-50 overlay). They stay visible but dimmed and inert, like the rest of the app, so nothing looks clickable that isn't. Nothing is hidden, so you can still see a toast has an action.
  • A press on a dimmed toast brings the stack forward (z-60). The press is captured before it reaches the backdrop, so the modal isn't dismissed and keeps its focus and unsaved input.
  • A toast raised while the modal is open comes forward by itself, so errors raised by the modal's own flow stay readable (fix(ui): dismiss notifications without closing modal editors #32065).
  • Once raised, close and actions work above the modal. Close dismisses only the toast ([Bug]: Notification close button is blocked while a modal is open #32064). Running an action, especially one that navigates, is an explicit escape hatch: it emits toast_action_over_modal so we can see when people need it and redesign that flow.
  • Each modal starts with the stack lowered, and it returns to normal (z-47) when the modal closes. While lowered, fix(ui): dismiss notifications without closing modal editors #32065's close-only click gate still applies (e.g. keyboard focus).

Telemetry: toast_action_over_modal

prop values
toast_id the toast's static developer id (e.g. unpaired-device-auth-failure); dynamic or unnamed ids report unnamed
modal_kind dialog | sheet
raised_by click (user pressed a dimmed toast) | new_toast (toast arrived while the modal was open)

Suggested dashboard: count of toast_action_over_modal by toast_id and raised_by over time.

Performance

  • No :has().
  • The z-index variable is now set on the toaster element itself, not inherited from body, so opening a modal restyles only the toaster instead of the whole tree.
  • Modal state comes from one MutationObserver filtered to the single data-modal-overlay-open body attribute.
  • The window pointerdown capture listener exists only while a modal is open and toasts are lowered. Before reading any rects it checks target.matches(overlay).

History

  1. All actions clickable: let navigating actions run unannounced behind a modal and could lose drafts.
  2. Modal-safe opt-in: dropped after a design review found Escape data loss with sheets, swallowed Escapes, and attribute-ownership problems.
  3. Hide actions: users could dismiss a toast without ever knowing it had an action.

This design keeps everything visible and honest, and makes going around the modal a deliberate, measured choice.

Validation

  • pnpm tc ✅, oxlint ✅, telemetry schema tests (telemetry-events, telemetry-payload-contracts) ✅

  • tests/e2e/add-project-error-toast-stacking.spec.ts 4/4 ✅, every case in dark and light.

    • All of fix(ui): dismiss notifications without closing modal editors #32065's coverage is kept: the error raised by the dialog stays readable above it (z 60 > overlay), close keeps the draft and focus (mouse + touch, standard + custom toast), credential z-140 still covers toasts, z-47 after close, and the nonmodal drawer / scroll-lock checks. The star-nag "Later" now runs, since that toast arrived while the modal was open.
    • New Settings → Browser → Add Profile test (6/6 across repeats):
      • an older toast sits behind the backdrop (z-49, its close not hit-testable);
      • a real mouse press brings it forward (z-60) with the dialog, draft and focus intact;
      • close dismisses only the toast;
      • a reopened dialog starts lowered, and a new toast comes forward by itself;
      • "Open Mobile Settings" then runs as the escape hatch and records exactly one toast_action_over_modal {toast_id: 'unpaired-device-auth-failure', modal_kind: 'dialog', raised_by: 'new_toast'}, validated against the schema.
  • Sheet coverage: the fixture ui/sonner:olderToastBehindModalSheet (pnpm fixtures:shot; e2e can't open a modal Sheet without integration data). It mounts the production Sheet, Toaster and stylesheet, and asserts:

    • an older toast sits behind the Sheet backdrop and its action doesn't run;
    • a press on the backdrop over it raises it without closing the Sheet;
    • close dismisses only the toast, keeping the draft and focus.

    It uses synthetic events and isn't run in CI.

  • Visual proof: see the newest proof comment; older ones are marked outdated.

…kable but dead

Radix modals dismiss/refocus on outside pointerdown, so the Toaster already swallowed
pointerdown inside toasts; it additionally swallowed click for every control except the
close button, making actions like 'Update skill' look live while doing nothing. Keep the
pointerdown shield (modal stays open, focus/input intact) and let the click run.
@nwparker

nwparker commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Warning

Outdated. This proof is for the first design (all toast actions clickable above a modal), which was rejected because it broke #32064 and could unmount a dialog's draft. See the newer proof comment below for the current default-deny design.

Original (outdated) proof

Visual proof: toast actions above a modal Dialog

Captured from a hidden (ORCA_BACKGROUND_LAUNCH=1) e2e-mode build, with "Add a project" open as the modal. Each run asserts that the dialog stays open and that document.activeElement stays inside it after each toast click. The before and after runs use the same scripted proof spec; the after video passed 3/3 repeats.

Case 1: non-navigating toast action ("Later") over the modal

Before (main): click is swallowed and the toast stays After (this PR): action runs and the toast closes; dialog stays open
before later after later

Starting state, same in both: toast over dialog

Case 2: an action that opens a page lands behind the still-open modal

Toast before clicking: open settings toast

Before (main): "Open Mobile Settings" does nothing After (this PR): Settings opens behind the dialog, which stays open and focused
before open settings after open settings

This is the trade-off flagged in the PR. The page change is visible only through the dimmed backdrop until the user closes the dialog.

Videos

Before (main): before video

After (this PR): after video

…with a modal-safe opt-in

Restores #32065's lock (close always works; actions that navigate or change settings
don't bypass the modal) and fixes the clickable-but-dead look: blocked controls get
aria-disabled, a 'Close the dialog to use this' title, and disabled styling, updated
live as modals open and close. Background/toast-local actions opt in via
modalSafeToastActionLabel or data-toast-modal-safe.
@nwparker

nwparker commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Warning

Outdated. This proof is for the modal-safe opt-in design, which was dropped in favour of hiding toast actions while a modal is open. See the newest proof comment below.

Original (outdated) proof

Visual proof (current design: default-deny + modal-safe opt-in)

Captured from hidden (ORCA_BACKGROUND_LAUNCH=1) e2e-mode builds with the same scripted proof spec. Before = main. Old PR = this PR's first design (38be9fe). After = this PR's head (af5d5a3). The after videos passed 3/3 repeats.

1. Clickable-but-dead is gone: blocked actions now look disabled

Before (main): "Open GitHub" and "Open Mobile Settings" look live but do nothing After: blocked actions are dimmed, aria-disabled, with a "Close the dialog to use this" title
before navigating action after navigating action disabled

2. A modal-safe action ("Later") runs above the modal

Star-nag toast: "Open GitHub" disabled, "Later" (modal-safe) enabled After clicking Later: the toast is gone; the dialog stays open and keeps focus
after star toast after later

On main the same click on "Later" is silently swallowed: before later

3. Close still dismisses only the toast (#32064)

after close

4. Reviewer repro: a navigating action must not unmount a dialog's draft

Settings → Browser → Add Profile, type a name, then click "Open Mobile Settings" on the toast.

Draft + toast (after) Old PR design: Mobile settings replaced the dialog, draft lost After: action blocked, dialog and draft intact
draft (screenshot removed: contained real product data) after kept

(The captures from section 4 are cropped to the dialog area so the Mobile pane's machine address stays out of frame.)

Videos

Before (main): before video

After: after video

After, browser-profile draft scenario: after draft video

@nwparker nwparker changed the title fix(ui): let toast actions work above a modal instead of looking clickable but dead fix(ui): toast actions above a modal are visibly disabled unless marked modal-safe Nov 1, 2026
…closes

A modal-safe action that opens a trigger-less dialog (Update skill) left focus on body
after close, minimize or Escape. captureDialogReturnFocus records the focused element
before opening and restores it via onCloseAutoFocus.

Also harden Dialog Escape: Radix arms a just-opened sibling dialog's Escape a render
late, so an early Escape closed the dialog beneath and dropped its draft. A dialog now
ignores Escape while a later-opened modal is open.
…ckable-looking but dead

Replaces the modal-safe opt-in design. Main's close-only capture gate stays as is; a
single CSS rule hides every toast control except close while a modal overlay is open,
so the message and dismissal remain and actions return once the modal closes.
@nwparker

nwparker commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Warning

Outdated. This proof is for the "hide actions above a modal" design, which was replaced: toasts now sit behind the modal backdrop until pressed. See the newest proof comment below.

Original (outdated) proof

Visual proof (current design: toast actions hidden while a modal is open)

Captured from hidden (ORCA_BACKGROUND_LAUNCH=1) e2e-mode builds with the same scripted proof spec. Before = main, After = this PR. The after video passed 3/3 repeats.

With a modal open

Before (main): "Open Mobile Settings" looks live but does nothing After: the message and close (×) stay visible; the action is hidden
before modal open after modal open

After the modal closes, the action is back

after modal closed

Close still dismisses only the toast; the modal stays open (#32064)

after close over modal

Videos

Before (main): before video

After: after video

@nwparker nwparker changed the title fix(ui): toast actions above a modal are visibly disabled unless marked modal-safe fix(ui): hide toast actions above a modal instead of leaving them clickable-looking but dead Nov 1, 2026
…raised

Older toasts drop behind an open Dialog/Sheet backdrop, dimmed and inert, so nothing looks
clickable that isn't. A press on one, or a toast raised while the modal is open, brings the
stack forward; close and actions then work above the modal with its focus and draft intact.
Actions run that way are an escape hatch and emit toast_action_over_modal.
@nwparker

nwparker commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Visual proof (current design: toasts behind the modal backdrop until pressed)

Captured from hidden (ORCA_BACKGROUND_LAUNCH=1) e2e-mode builds with the same scripted proof spec. Before = main, After = this PR. The after video passed 3/3 repeats.

1. An older toast with a modal open

Before (main): drawn above the backdrop; "Open Mobile Settings" looks live but does nothing After: behind the backdrop, dimmed like the rest of the app
before after

2. Pressing the dimmed toast brings it forward, and the modal stays open

after press

3. Close dismisses only the toast (#32064)

after close

4. A toast raised while the modal is open comes forward immediately (errors stay readable, #32065)

after new toast

Videos

Before (main): before video

After: after video

@nwparker nwparker changed the title fix(ui): hide toast actions above a modal instead of leaving them clickable-looking but dead fix(ui): toasts sit behind a modal's backdrop until pressed, instead of looking live but dead Nov 1, 2026
@nwparker
nwparker marked this pull request as ready for review November 1, 2026 09:09
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8975ee81-8dd7-484d-87f1-e9f390d0193f
Commits

Reviewing files that changed from the base of the PR and between ea70d35 and 29c5b4c.

Files selected for processing: 1
  • tests/e2e/add-project-error-toast-stacking.spec.ts

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b6dce3da-a67f-4b67-95e8-21fd98036086
Commits

Reviewing files that changed from the base of the PR and between fbb3381 and ea70d35.

Files selected for processing: 8
  • docs/STYLEGUIDE.md
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/ui/sonner.fixture.tsx
  • src/renderer/src/components/ui/sonner.tsx
  • src/renderer/src/components/ui/toaster-modal-layer.ts
  • src/shared/telemetry-event-registry.ts
  • src/shared/telemetry-feature-education-event-schemas.ts
  • tests/e2e/add-project-error-toast-stacking.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

Older toasts start behind an open modal. Pressing an older toast or showing a new toast raises the stack. The Toaster applies different interaction handling based on the raised state, and eligible toast actions emit a registered telemetry event. The changes add fixture and end-to-end checks for modal state, draft input, focus, toast dismissal, navigation, and telemetry properties.

Merge Risk: Minimal · previous review ea70d

The toast and modal changes have no established issue requiring resolution before merge. Normal validation remains appropriate.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main UI change: toasts remain behind a modal backdrop until the user presses them.
Description check Passed The description is detailed and covers the problem, user-visible behavior, implementation, telemetry, performance, visual proof, testing, and validation. It does not follow the template headings exact…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the problem, user-visible behavior, implementation, telemetry, performance, visual proof, testing, and validation. It does not follow the template headings exactly and omits the checklist and explicit Linked Issue section, but the required information is mostly present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 6 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

1 participant