Skip to content

fix(toast): show toasts above open modal dialogs - #22117

Closed
midego1 wants to merge 2 commits into
stablyai:mainfrom
midego1:midego1/bug-error-toast-for-invalid-path-is-hidden-behin
Closed

midego1 wants to merge 2 commits into
stablyai:mainfrom
midego1:midego1/bug-error-toast-for-invalid-path-is-hidden-behin

Conversation

@midego1

@midego1 midego1 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

ELI5

When adding a project failed while a dialog was open, the error message popped up behind the dialog's dimmed, blurred background, so you couldn't read it. Now the error shows on top of the dialog.

What Changed

Before: in "Set project location" (or any other modal dialog), choosing an invalid path showed a "Failed to add project" toast in the bottom-right corner, but it was blurred and dimmed behind the dialog's backdrop.

After: while a modal dialog is open, toasts render above it and are fully readable. When no dialog is open, toasts keep their current stacking order.

Mechanism: Orca pins the toast layer to z-index: 40, and dialogs and their backdrop use z-50, so any toast raised from inside a dialog landed underneath it. Radix modals set a data-scroll-locked attribute on <body> while open (via react-remove-scroll-bar). A new CSS rule, body[data-scroll-locked] [data-sonner-toaster], lifts the toast layer to z-index: 60 only while that attribute is present.

Why

The z-index: 40 was chosen on purpose (#16729) so toasts sit below the native-chat pane's interrupt controls (z-50) while an agent is working. Raising toasts globally would cover those controls again. Closing the dialog before showing the error would lose what the user typed, and would only fix this one flow. Tying the lift to "a modal is open" fixes every dialog at once and leaves the native-chat case unchanged. While a modal is open, the chat pane is behind the dialog anyway.

While a modal is open, toasts stay visible but not clickable, because Radix disables pointer events outside the dialog. That matches the behavior before this change.

Linked Issue

Fixes #22107

Visual Proof

Both captured from the real app by the new E2E spec, using an isolated profile on a headless window. The screenshots are identical except for the fix.

Before After
Before: error toast blurred behind the Add project dialog backdrop After: error toast readable above the Add project dialog

Testing

  • New E2E spec tests/e2e/add-project-error-toast-stacking.spec.ts. It opens the Add project dialog and fires the same "Set location" action with a non-git folder. It then asserts that the "Failed to add project" toast is the topmost element at its own center. It fails on main ("dialog overlay covers the error toast") and passes with this change.

  • New unit test src/renderer/src/assets/toaster-stacking-style.test.ts. It locks both rules: below z-50 with no modal open, above z-50 while one is open.

  • pnpm tc, oxlint, and pnpm run check:code-quality:changed pass.

  • Platforms: tested on Linux only, with headless Electron under Xvfb. The change is CSS-only and has no platform branches. The remote/SSH flow from the issue uses the same dialog and toast components, but I did not reproduce it against a real remote host.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Investigation, fix, tests, and screenshots were produced with Claude Code (Claude Opus 5). I reviewed the change.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Security: none, CSS only.
  • Cross-platform: no platform-specific code.
  • SSH/remote: renderer-only stacking change, so no wire or host changes.
  • Mobile/web client: same stylesheet, same behavior.
  • Performance: an attribute selector on <body> with no :has(). It only re-matches when a modal opens or closes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

Toasts are pinned to z-index 40 so they stay below the native chat
interrupt controls, but dialogs and their backdrop sit at z-50. Errors
raised from inside a dialog (e.g. an invalid path in "Set project
location") were blurred behind its overlay.

Radix modals set data-scroll-locked on <body> while open; lift the
toaster to z-index 60 only then, so the no-modal stacking is unchanged.

Fixes stablyai#22107

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 0834176e-180b-4246-9cb0-ed936a66fada

📥 Commits

Reviewing files that changed from the base of the PR and between 9666fb0 and ea6505f.

📒 Files selected for processing (1)
  • src/renderer/src/assets/toaster-stacking-style.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/assets/toaster-stacking-style.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The stylesheet raises Sonner toasts to z-index 60 when body[data-scroll-locked] is present. A Vitest suite checks the normal and locked stacking values and the dialog z-index. An end-to-end test triggers an invalid-path project setup and verifies that the error toast remains visible above the open Add project dialog.

Priority: ⬇️ Low

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: showing toast notifications above open modal dialogs.
Description check ✅ Passed The description is complete and focused. It includes the user-facing impact, implementation details, rationale, linked issue, visual proof, testing, platform scope, AI disclosure, and checklist status…
Linked Issues check ✅ Passed Issue [#22107] requires the invalid-path error toast to remain fully visible while the folder-selection screen is open. The PR keeps the default toaster at z-index: 40 and sets `body[data-scroll-loc…
Out of Scope Changes check ✅ Passed The CSS rule directly addresses the stacking defect in [#22107]. The unit test and E2E regression test support that fix. The reviewed changes contain no demonstrated unrelated product behavior or unre…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.

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

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one scope caveat and one inline note.

Reviewed changes

  • Toast lift while the body is scroll-locked — adds body[data-scroll-locked] [data-sonner-toaster] { z-index: 60 !important } so toasts clear the z-50 dialog overlay only while Radix's scroll-lock attribute is on <body> (src/renderer/src/assets/main.css:404).
  • Style unit test — reads main.css and ui/dialog.tsx to pin the base toaster layer below 50 and the locked layer above 50 (src/renderer/src/assets/toaster-stacking-style.test.ts:16).
  • E2E regression spec — opens the Add project dialog, drives the non-git-path failure through setupProjectExistingFolder, and hit-tests the toast at its own center to prove it is the topmost element (tests/e2e/add-project-error-toast-stacking.spec.ts:17).

I confirmed the toaster is rendered inline in App.tsx:106 inside .app-layout, which does not create a stacking context, so the lift does beat the body-level z-50 dialog portal — the fix works for the reported flow, and the E2E assertion (temporarily re-enabling pointer events before elementFromPoint) can genuinely fail on main.

ℹ️ Dialogs that override the shared z-50 remain covered

A handful of Radix dialogs raise their overlay/content above the shared Dialog's z-50. They still lock the body, so the toaster stays at 60 and a toast raised from inside them is still painted behind the overlay — the same symptom as #22107. The PR rationale says tying the lift to "a modal is open" fixes "every dialog at once"; that holds for the default z-50 dialog but not for these. If the coverage matters, the lift needs to clear the highest modal tier (or a shared z token) rather than a flat 60.

Technical details
# Higher-z modal dialogs left uncovered

## Affected sites
- `src/renderer/src/components/link-routing-preference-dialog.tsx:131` — overlay `!z-[140]`, content `!z-[150]`
- `src/renderer/src/components/settings/SshPassphraseDialog.tsx:119` — overlay `!z-[140]`, content `!z-[150]`
- `src/renderer/src/components/settings/jira-integration-card.tsx:252` — `z-[110]`/`z-[120]`
- `src/renderer/src/components/settings/task-tracker-integration-cards.tsx:224` — `z-[110]`/`z-[120]`
- `src/renderer/src/components/onboarding/OnboardingSkipConfirmationDialog.tsx:42` — `z-[120]`/`z-[130]`
- `src/renderer/src/components/onboarding/IntegrationsStep.tsx:212` — `z-[110]`/`z-[120]`

## Required outcome
- Decide whether toasts should surface above these dialogs too; if so, the lift must exceed the
  highest modal tier rather than a flat `60`. If not, the "every dialog at once" claim is worth
  narrowing.

## Open questions for the human
- Are errors ever toasted from inside the onboarding / integration / credential dialogs, or is
  the default `z-50` dialog the only realistic source?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +404 to +408
/* Why: modals (z-50) lock body scroll; lift toasts above them so errors raised
from inside a dialog stay readable instead of blurred behind its overlay. */
body[data-scroll-locked] [data-sonner-toaster] {
z-index: 60 !important;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

data-scroll-locked is not modal-only: Radix sets it on <body> for any RemoveScroll mount, which in this app includes every Select and any DropdownMenu (Radix defaults modal), not just dialogs. The comment here scopes the trigger to modals, but the lift also applies while a Select or modal dropdown is open, moving toasts above z-50 chrome that has nothing to do with a modal. Worth either describing the real trigger in the comment or confirming the broader lift is intended.

Technical details
# `data-scroll-locked` trigger is broader than "modals"

## Affected sites
- `src/renderer/src/assets/main.css:404` — the Why comment says "modals (z-50) lock body scroll"
- `src/renderer/src/assets/main.css:406` — the rule fires on any `body[data-scroll-locked]`

## Evidence
- `react-remove-scroll-bar` `useLockAttribute` sets `document.body[data-scroll-locked]` (node_modules/react-remove-scroll-bar/dist/es2019/component.js:59-72).
- `SelectContent` mounts `RemoveScroll` unconditionally: `src/renderer/src/components/ui/select.tsx:76` (content `z-[70]`).
- `DropdownMenu` defaults to `modal` and Orca forwards props unchanged: `src/renderer/src/components/ui/dropdown-menu.tsx:7`.
- `ContextMenu` pins `modal={false}` so it does not lock: `src/renderer/src/components/ui/context-menu.tsx:8`. `Popover` defaults non-modal, so it does not lock either.

## Required outcome
- Either update the comment to describe the actual trigger (any body scroll lock: dialogs, selects, modal menus), or key the lift to a modal-specific signal if the narrower behavior was the intent.

@nwparker

Copy link
Copy Markdown
Contributor

Closing as superseded by merged #22423, which carries the reviewed fix and regression coverage. Thank you for the original contribution.

@nwparker nwparker closed this Sep 26, 2026
@midego1

midego1 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Closing as superseded by merged #22423, which carries the reviewed fix and regression coverage. Thank you for the original contribution.

Will I now become an official contributor? 👯 @nwparker

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.

[Bug]: Error toast for invalid path is hidden behind the folder selection screen when adding a project on a remote machine

2 participants