Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(desktop): portal route dialogs above the sidebar

vastsaa8db8144d601
diff --git a/apps/desktop/src/components/ReleaseNotesDialog.tsx b/apps/desktop/src/components/ReleaseNotesDialog.tsx
index c035cc3ff..b2860d76f 100644
--- a/apps/desktop/src/components/ReleaseNotesDialog.tsx
+++ b/apps/desktop/src/components/ReleaseNotesDialog.tsx
@@ -5,9 +5,8 @@ import {
normalizeChangelogVersion,
resolveChangelogLocale,
} from "@pi-desktop/shared";
-import { Badge, cx } from "./ui";
+import { Badge, cx, portalOverlay, TooltipButton } from "./ui";
import { IconClose } from "./icons";
-import { TooltipButton } from "./ui";
export function ReleaseNotesDialog({
currentVersion,
@@ -76,7 +75,7 @@ export function ReleaseNotesDialog({
};
}, [onClose]);
- return (
+ return portalOverlay(
<div
className="overlay release-notes-overlay"
role="presentation"
@@ -156,6 +155,6 @@ export function ReleaseNotesDialog({
})}
</div>
</div>
- </div>
+ </div>,
);
}
diff --git a/apps/desktop/src/components/plugins/PluginInstallDialog.tsx b/apps/desktop/src/components/plugins/PluginInstallDialog.tsx
index c2a1a4d6d..557e3f04a 100644
--- a/apps/desktop/src/components/plugins/PluginInstallDialog.tsx
+++ b/apps/desktop/src/components/plugins/PluginInstallDialog.tsx
@@ -6,7 +6,7 @@ import {
type PluginInstallJob,
} from "../../features/plugins/install-progress";
import { useAppStore } from "../../stores/app-store";
-import { Button, cx } from "../ui";
+import { Button, cx, portalOverlay } from "../ui";
import {
IconCircleCheck,
IconCopy,
@@ -106,7 +106,7 @@ export function PluginInstallDialog({ job, onCancel, onRetry, onClose }: Props)
return <IconDownload size={size} />;
};
- return (
+ return portalOverlay(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal plugins-install-modal"
@@ -252,6 +252,6 @@ export function PluginInstallDialog({ job, onCancel, onRetry, onClose }: Props)
)}
</div>
</div>
- </div>
+ </div>,
);
}
diff --git a/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx b/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx
index 201d69979..2e7f21cdf 100644
--- a/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx
+++ b/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx
@@ -15,7 +15,16 @@ import {
} from "@pi-desktop/shared";
import { api } from "../../lib/api";
import { useAppStore } from "../../stores/app-store";
-import { Button, HelpIcon, SettingsToggle, TooltipButton, cx, Input, Textarea } from "../ui";
+import {
+ Button,
+ HelpIcon,
+ Input,
+ SettingsToggle,
+ Textarea,
+ TooltipButton,
+ cx,
+ portalOverlay,
+} from "../ui";
import { IconKeyboard, IconSettings, IconX } from "../icons";
import { SettingsMenuSelect } from "../settings/SettingsMenuSelect";
@@ -145,7 +154,7 @@ export function PluginSettingsSheet({ plugin, platform, onClose, onSaved }: Prop
setRecordingKey(null);
};
- return (
+ return portalOverlay(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal plugins-settings-modal"
@@ -255,6 +264,6 @@ export function PluginSettingsSheet({ plugin, platform, onClose, onSaved }: Prop
</Button>
</div>
</div>
- </div>
+ </div>,
);
}
diff --git a/apps/desktop/src/features/plugins/PluginDetailSheet.tsx b/apps/desktop/src/features/plugins/PluginDetailSheet.tsx
index 90e62798d..bfed34d75 100644
--- a/apps/desktop/src/features/plugins/PluginDetailSheet.tsx
+++ b/apps/desktop/src/features/plugins/PluginDetailSheet.tsx
@@ -1,4 +1,4 @@
-import { Button, TooltipButton, cx } from "../../components/ui";
+import { Button, TooltipButton, cx, portalOverlay } from "../../components/ui";
import {
IconCheck,
IconLink,
@@ -40,8 +40,8 @@ export function PluginDetailSheet({
queueInstall,
setSelectedVersion,
}: PluginsPageModel) {
- return (
- selectedId ? (
+ return selectedId
+ ? portalOverlay(
<div className="plugins-sheet-layer">
<button
type="button"
@@ -353,8 +353,7 @@ export function PluginDetailSheet({
</>
)}
</aside>
- </div>
-
- ) : null
- );
+ </div>,
+ )
+ : null;
}
diff --git a/apps/desktop/src/features/plugins/PluginDialogs.tsx b/apps/desktop/src/features/plugins/PluginDialogs.tsx
index 623897393..875174891 100644
--- a/apps/desktop/src/features/plugins/PluginDialogs.tsx
+++ b/apps/desktop/src/features/plugins/PluginDialogs.tsx
@@ -1,4 +1,4 @@
-import { Button, SettingsToggle, cx } from "../../components/ui";
+import { Button, SettingsToggle, cx, portalOverlay } from "../../components/ui";
import { IconCheck, IconShield, IconSparkles, IconTriangleAlert } from "../../components/icons";
import { PluginInstallDialog } from "../../components/plugins/PluginInstallDialog";
import { PluginSettingsSheet } from "../../components/plugins/PluginSettingsSheet";
@@ -37,7 +37,8 @@ export function PluginDialogs({
}: PluginsPageModel) {
return (
<>
- {pendingReview ? (
+ {pendingReview
+ ? portalOverlay(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal"
@@ -90,9 +91,11 @@ export function PluginDialogs({
</Button>
</div>
</div>
- </div>
- ) : null}
- {pendingInstall ? (
+ </div>,
+ )
+ : null}
+ {pendingInstall
+ ? portalOverlay(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal"
@@ -148,8 +151,9 @@ export function PluginDialogs({
</Button>
</div>
</div>
- </div>
- ) : null}
+ </div>,
+ )
+ : null}
{installJob ? (
<PluginInstallDialog
job={installJob}
@@ -172,7 +176,8 @@ export function PluginDialogs({
}}
/>
) : null}
- {templatePick ? (
+ {templatePick
+ ? portalOverlay(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal"
@@ -245,8 +250,9 @@ export function PluginDialogs({
</Button>
</div>
</div>
- </div>
- ) : null}
+ </div>,
+ )
+ : null}
</>
);
}
diff --git a/apps/desktop/src/styles/chat-shell.css b/apps/desktop/src/styles/chat-shell.css
index 1ba00e006..893be6e20 100644
--- a/apps/desktop/src/styles/chat-shell.css
+++ b/apps/desktop/src/styles/chat-shell.css
@@ -166,8 +166,9 @@
.settings-content-enter {
/* No `forwards`/`both` fill: this entrance ends on the element's own state,
so a fill would only keep the animation "in effect" — and with it the
- stacking context that left route-level overlays (the plugin modals, the
- plugin detail sheet) underneath the opaque titlebar band. */
+ stacking context that can leave any legacy route-level fixed surface
+ underneath the opaque titlebar band. Modal surfaces use the viewport
+ overlay host, but keeping this invariant protects other fixed content. */
animation: route-surface-in var(--motion-duration-normal) var(--motion-ease-out);
}
diff --git a/apps/desktop/src/styles/plugins.css b/apps/desktop/src/styles/plugins.css
index 453326798..502ddf505 100644
--- a/apps/desktop/src/styles/plugins.css
+++ b/apps/desktop/src/styles/plugins.css
@@ -1258,6 +1258,10 @@
}
/* Detail sheet: a right-side overlay instead of a nested-border sidebar. */
+#pi-desktop-overlays > .plugins-sheet-layer {
+ pointer-events: auto;
+}
+
.plugins-sheet-layer {
position: fixed;
inset: 0;
@@ -1751,6 +1755,11 @@
line-height: var(--leading-body);
}
+/* The shared overlay host is inert until a portaled surface opts back in. */
+#pi-desktop-overlays > .plugins-modal-backdrop {
+ pointer-events: auto;
+}
+
/* Permission review dialog: the last stop before granting capabilities. */
.plugins-modal-backdrop {
position: fixed;
diff --git a/apps/desktop/test/plugin-install-dialog.test.mjs b/apps/desktop/test/plugin-install-dialog.test.mjs
index 62f6289a8..1bc82a9ef 100644
--- a/apps/desktop/test/plugin-install-dialog.test.mjs
+++ b/apps/desktop/test/plugin-install-dialog.test.mjs
@@ -228,6 +228,18 @@ test("Escape dismisses a finished install but never a running download", () => {
assert.match(dialogSrc, /className="plugins-modal-actions"/);
});
+test("the install dialog is mounted above the route and sidebar stacking contexts", () => {
+ assert.match(dialogSrc, /portalOverlay\(/);
+ assert.match(
+ dialogSrc,
+ /return portalOverlay\(\s*<div className="plugins-modal-backdrop"/,
+ );
+ assert.match(
+ pluginsCss,
+ /#pi-desktop-overlays > \.plugins-modal-backdrop\s*\{[^}]*pointer-events:\s*auto;/,
+ );
+});
+
test("install dialog copy exists in every shipped locale", () => {
const keys = [
"plugins.installDialogTitle",
diff --git a/apps/desktop/test/plugins-page-style.test.mjs b/apps/desktop/test/plugins-page-style.test.mjs
index 9698272b7..3d02566cc 100644
--- a/apps/desktop/test/plugins-page-style.test.mjs
+++ b/apps/desktop/test/plugins-page-style.test.mjs
@@ -140,9 +140,9 @@ test("installed row controls share one aligned rail and explain icon actions", (
// rightmost 120px. The page header lives in that band, so the frame must reserve
// it on macOS too or the title row paints underneath. The plugins page is the one
// destination page with controls in that corner (header actions, detail-sheet
-// close), so both must clear the band. The sheet's fixed layer stacks inside the
-// route surface (its entry animation leaves a transform behind), so the band
-// paints over the sheet on every platform and the sheet reserves it everywhere.
+// close), so both must clear the band. The sheet mounts on the viewport overlay
+// host, so its fixed layer is independent of the route surface while its own
+// head still reserves the titlebar band.
test("plugins page keeps its header clear of the titlebar band on every platform", () => {
assert.match(
stylesSource,
diff --git a/apps/desktop/test/settings-dialog-overlay.test.mjs b/apps/desktop/test/settings-dialog-overlay.test.mjs
index 16e01d796..650780f25 100644
--- a/apps/desktop/test/settings-dialog-overlay.test.mjs
+++ b/apps/desktop/test/settings-dialog-overlay.test.mjs
@@ -6,12 +6,17 @@ import { loadStyles } from "./helpers/styles.mjs";
const read = (rel) => readFile(new URL(rel, import.meta.url), "utf8");
const overlaySources = [
+ "../src/components/ReleaseNotesDialog.tsx",
+ "../src/components/plugins/PluginInstallDialog.tsx",
+ "../src/components/plugins/PluginSettingsSheet.tsx",
"../src/components/settings/ProviderSetupDialog.tsx",
"../src/components/settings/VendorAccountDialog.tsx",
"../src/components/settings/OAuthLoginDialog.tsx",
"../src/components/settings/SkillEditorSheet.tsx",
"../src/components/settings/SubagentEditorSheet.tsx",
"../src/components/extensions/McpEditorSheet.tsx",
+ "../src/features/plugins/PluginDialogs.tsx",
+ "../src/features/plugins/PluginDetailSheet.tsx",
];
test("route entrance does not leave a transform containing block", async () => {
@@ -27,9 +32,9 @@ test("route entrance does not leave a transform containing block", async () => {
/\.route-surface,\s*\.settings-content-inner\s*\{[^}]*animation:\s*route-surface-in/,
);
// No fill either: the entrance ends on the element's own state, so a fill
- // would only keep the animation in effect — and with it the stacking context
- // that left route-level overlays (the plugin modals, the plugin detail
- // sheet) underneath the opaque titlebar band.
+ // would only keep the animation in effect and trap legacy route-level fixed
+ // surfaces under the opaque titlebar band. Modal surfaces use the viewport
+ // overlay host, but this remains a shell invariant for fixed content.
const entrance = styles.match(
/\.route-surface,\n\.settings-content-enter \{[^}]*\}/,
);
@@ -48,6 +53,16 @@ test("settings overlays mount on a viewport-fixed host outside the app shell", a
assert.match(host[0], /position:\s*fixed/);
assert.match(host[0], /inset:\s*0/);
+ const pluginsCss = await read("../src/styles/plugins.css");
+ assert.match(
+ pluginsCss,
+ /#pi-desktop-overlays\s*>\s*\.plugins-modal-backdrop\s*\{[^}]*pointer-events:\s*auto;/,
+ );
+ assert.match(
+ pluginsCss,
+ /#pi-desktop-overlays\s*>\s*\.plugins-sheet-layer\s*\{[^}]*pointer-events:\s*auto;/,
+ );
+
const ui = await read("../src/components/ui.tsx");
assert.match(ui, /export function portalOverlay/);
assert.match(ui, /pi-desktop-overlays/);
@@ -58,6 +73,13 @@ test("settings overlays mount on a viewport-fixed host outside the app shell", a
const source = await read(rel);
assert.match(source, /portalOverlay\(/, `${rel} must portal its overlay`);
}
+
+ const pluginDialogs = await read("../src/features/plugins/PluginDialogs.tsx");
+ assert.equal(
+ pluginDialogs.match(/portalOverlay\(/g)?.length,
+ 3,
+ "each route-owned plugin modal must mount on the overlay host",
+ );
});
// A route overlay is no longer trapped under the window chrome (see the
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 6ad157cf7..63ec1467f 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -316,9 +316,9 @@ combined model × reasoning selection (§11).
chat transcript scroller; Composer-specific occlusion and follow behavior must
not fade or hide destination rows at the bottom of the page.
Without that reservation a page header renders behind the band and its title
- row is clipped. The plugin detail sheet reserves it too (D296): the route
- surface keeps a transform after its entry animation, so the sheet's fixed
- layer stacks inside the route rather than above the band.
+ row is clipped. The plugin detail sheet reserves it too (D296): the sheet is
+ mounted on the viewport overlay host, so its fixed layer is independent of
+ the route scroller and the titlebar band.
### 2.4 States
@@ -488,6 +488,11 @@ visually distinct from list content.
unmounts normally, releasing listeners, and an operation already in flight
still completes and reports through the normal toast channel; this is not a
hidden live workbench or durable preference across application restart.
+- Plugin detail, settings, permission-review, template, and install-progress
+ surfaces are viewport-wide overlays. Their backdrops and surfaces mount on
+ `#pi-desktop-overlays`, outside the route scroll container and sidebar
+ stacking contexts, so an expanded sidebar cannot cover the surface or its
+ close/cancel controls.
- The footer action group stays on the left and the build/version chip stays
right-aligned; clicking the chip checks for updates or opens the available
release in Settings
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index ccbf7d1f0..2cbcbec72 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -1765,9 +1765,9 @@ identify the platform validation still needed.
Scrolling Plugins, Scheduled, and Pull requests uses a destination-owned
scroller rather than the chat transcript scroller, so the bottom rows remain
fully painted and reachable instead of inheriting the Composer occlusion mask.
- The plugin detail sheet stacks above the band (`z-index: 60`) and keeps its
- own head at the top edge, with its close button opting out of the drag
- rectangle.
+ The plugin detail sheet mounts on the viewport overlay host, stays above the
+ expanded sidebar and titlebar band, and keeps its own head at the top edge,
+ with its close button opting out of the drag rectangle.
- **Specs linked**: `04-ux/08-component-spec.md` (§2.3 Layout)
- **Acceptance**: C (UI), Quality
- **Milestone**: M2
@@ -2619,7 +2619,7 @@ identify the platform validation still needed.
- **Preconditions**: Official marketplace catalog available.
- **Steps**: 1) Open Extensions → Marketplace. 2) Open details for `demo.workspace-summary`. 3) Inspect README / risk-grouped permissions / version rows. 4) Pick a version and install after permission review. 5) Dismiss the sheet with Escape and by clicking the scrim.
-- **Expected**: Detail sheet loads via `market.getDetail`; README, safety notes, and per-risk permission explanations render; the picked version drives the sticky install action; Escape and scrim both close the sheet without closing the permission dialog underneath.
+- **Expected**: Detail sheet loads via `market.getDetail`; README, safety notes, and per-risk permission explanations render; the picked version drives the sticky install action; the sheet mounts on the viewport overlay host above the expanded sidebar; Escape and scrim both close the sheet without closing the permission dialog underneath.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`
- **Acceptance**: G (marketplace detail UX)
- **Status**: Documented
@@ -2664,7 +2664,7 @@ identify the platform validation still needed.
- **Preconditions**: App running; official market catalog available.
- **Steps**: 1) Open Extensions → Marketplace. 2) Install `demo.workspace-notes`. 3) Read the risk-tiered permission dialog. 4) Accept high-risk permissions.
-- **Expected**: Permissions are grouped High / Medium / Low with plain-language explanations before any download; the host refreshes marketplace metadata immediately before download so a stale UI cache cannot pair an old checksum with a current package; plugin installed from the marketplace package, checksum verified, permissions granted, panel/tools available; the installed tab and risk-grouped rows reflect the new plugin without a separate overview card row.
+- **Expected**: Permissions are grouped High / Medium / Low with plain-language explanations before any download; the review dialog mounts on the viewport overlay host above the expanded sidebar; the host refreshes marketplace metadata immediately before download so a stale UI cache cannot pair an old checksum with a current package; plugin installed from the marketplace package, checksum verified, permissions granted, panel/tools available; the installed tab and risk-grouped rows reflect the new plugin without a separate overview card row.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`, `07-plugins/13-plugin-permissions-matrix.md`
- **Acceptance**: G (marketplace install + permission review)
- **Status**: Documented / host-core covered by unit tests + protocol methods
@@ -14743,7 +14743,7 @@ plugin-form fixtures in an isolated temporary directory at runtime.
- **Preconditions**: A clean profile on the official channel, a plugin whose resolve answer lists at least two entries, a first mirror that fails or is slow so a second attempt is observable, and a renderer subscribed to `plugin.installProgress`.
- **Steps**: 1) Start a manual install from the marketplace detail sheet. 2) Record the reports that arrive while it runs. 3) Hover the dialog after the install succeeds. 4) Look at the installed plugin once the install ends. 5) Install again with a large package and count the reports over a window of at least one second.
-- **Expected**: The dialog shows the phases in order — `resolve`, `download`, `verify`, `install`, `enable` — with `mirror n/N · name` and a determinate bar from `receivedBytes` / `totalBytes`; every report carries `pluginId` and `version`, only the report that names a mirror carries `source`, and `attempt` counts 1-based within `attempts` while a mirror switch increments `attempt` without changing `attempts`; byte reports arrive at most once per 200 ms, with one extra report per phase change and one terminal report; the install ends with no `error` and the plugin is installed and enabled after the ordinary permission review; the dialog closes about two seconds after success, that countdown pauses while it is hovered, and a background auto-update installs the same way without opening the dialog at all.
+- **Expected**: The dialog shows the phases in order — `resolve`, `download`, `verify`, `install`, `enable` — with `mirror n/N · name` and a determinate bar from `receivedBytes` / `totalBytes`; it is mounted on the viewport overlay host and remains fully above the expanded sidebar, including its cancel/close controls; every report carries `pluginId` and `version`, only the report that names a mirror carries `source`, and `attempt` counts 1-based within `attempts` while a mirror switch increments `attempt` without changing `attempts`; byte reports arrive at most once per 200 ms, with one extra report per phase change and one terminal report; the install ends with no `error` and the plugin is installed and enabled after the ordinary permission review; the dialog closes about two seconds after success, that countdown pauses while it is hovered, and a background auto-update installs the same way without opening the dialog at all.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md` §2, `07-plugins/15-plugin-center.md` §10, ADR 0276 §7
- **Acceptance**: G (remote marketplace source)
- **Milestone**: M6+