Skip to content

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

fix(plugins): hide docked native views under host plugin modals

ZxlDragonDoctorc2bbbc9d627e
diff --git a/apps/desktop/src/components/plugins/PluginInstallDialog.tsx b/apps/desktop/src/components/plugins/PluginInstallDialog.tsx
index 557e3f04a..1db9a458a 100644
--- a/apps/desktop/src/components/plugins/PluginInstallDialog.tsx
+++ b/apps/desktop/src/components/plugins/PluginInstallDialog.tsx
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
+import { useBlockingOverlay } from "../../lib/blocking-overlay";
import { useTranslation } from "react-i18next";
import {
canCancelInstall,
@@ -43,6 +44,8 @@ type Props = {
* the same request again; a success shows and steps aside.
*/
export function PluginInstallDialog({ job, onCancel, onRetry, onClose }: Props) {
+ // Hide docked native plugin views while this host install sheet is open.
+ useBlockingOverlay();
const { t } = useTranslation();
const showToast = useAppStore((state) => state.showToast);
const [hovered, setHovered] = useState(false);
diff --git a/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx b/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx
index 2e7f21cdf..e72794dd2 100644
--- a/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx
+++ b/apps/desktop/src/components/plugins/PluginSettingsSheet.tsx
@@ -14,6 +14,7 @@ import {
type ShortcutPlatform,
} from "@pi-desktop/shared";
import { api } from "../../lib/api";
+import { useBlockingOverlay } from "../../lib/blocking-overlay";
import { useAppStore } from "../../stores/app-store";
import {
Button,
@@ -67,6 +68,9 @@ function serializeJson(value: unknown): string {
}
export function PluginSettingsSheet({ plugin, platform, onClose, onSaved }: Props) {
+ // Native plugin views composite above the renderer; hide them while this
+ // host sheet is open so the right edge of the dialog stays clickable.
+ useBlockingOverlay();
const { t } = useTranslation();
const appKeybindings = useAppStore((state) => state.settings?.keybindings);
const settings = plugin.settings ?? [];
diff --git a/apps/desktop/src/features/plugins/PluginDialogs.tsx b/apps/desktop/src/features/plugins/PluginDialogs.tsx
index 875174891..055c5358e 100644
--- a/apps/desktop/src/features/plugins/PluginDialogs.tsx
+++ b/apps/desktop/src/features/plugins/PluginDialogs.tsx
@@ -2,6 +2,8 @@ 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";
+import { useBlockingOverlay } from "../../lib/blocking-overlay";
+import type { ReactNode } from "react";
import { useAppStore } from "../../stores/app-store";
import {
RISK_LABEL_KEYS,
@@ -12,6 +14,15 @@ import {
} from "./model";
import type { PluginsPageModel } from "./usePluginsPage";
+function pluginModalPortal(node: ReactNode) {
+ return portalOverlay(<PluginModalBlockingHost>{node}</PluginModalBlockingHost>);
+}
+
+function PluginModalBlockingHost({ children }: { children: ReactNode }) {
+ useBlockingOverlay();
+ return <>{children}</>;
+}
+
export function PluginDialogs({
t,
pendingInstall,
@@ -38,7 +49,7 @@ export function PluginDialogs({
return (
<>
{pendingReview
- ? portalOverlay(
+ ? pluginModalPortal(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal"
@@ -95,7 +106,7 @@ export function PluginDialogs({
)
: null}
{pendingInstall
- ? portalOverlay(
+ ? pluginModalPortal(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal"
@@ -177,7 +188,7 @@ export function PluginDialogs({
/>
) : null}
{templatePick
- ? portalOverlay(
+ ? pluginModalPortal(
<div className="plugins-modal-backdrop" role="presentation">
<div
className="plugins-modal"
diff --git a/apps/desktop/test/plugin-settings.test.mjs b/apps/desktop/test/plugin-settings.test.mjs
index 6b4a5e15a..ba73d809a 100644
--- a/apps/desktop/test/plugin-settings.test.mjs
+++ b/apps/desktop/test/plugin-settings.test.mjs
@@ -52,3 +52,12 @@ test("settings writes validate values, notify the plugin, and never use global s
assert.doesNotMatch(runtime, /globalShortcut\.(?:register|unregister)\(/);
assert.match(runtime, /assertPermission\(loaded, "keyboard\.globalShortcut"\)/);
});
+
+test("host plugin modals hide docked native plugin views via blocking-overlay", async () => {
+ assert.match(sheet, /useBlockingOverlay/);
+ const installDialog = await read("../src/components/plugins/PluginInstallDialog.tsx");
+ assert.match(installDialog, /useBlockingOverlay/);
+ const dialogs = await read("../src/features/plugins/PluginDialogs.tsx");
+ assert.match(dialogs, /useBlockingOverlay/);
+ assert.match(dialogs, /PluginModalBlockingHost/);
+});