From 907c200181e7e1251d4d59698dbd865037b86692 Mon Sep 17 00:00:00 2001
From: BelKed <66956532+BelKed@users.noreply.github.com>
Date: Sat, 14 Nov 2026 23:42:09 +0100
Subject: [PATCH 06/13] fix(desktop): navigation dismisses a pending page
dialog
---
apps/desktop/src/preview/PageDialogs.test.ts | 13 +++++++++++
apps/desktop/src/preview/PageDialogs.ts | 24 +++++++++++---------
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/apps/desktop/src/preview/PageDialogs.test.ts b/apps/desktop/src/preview/PageDialogs.test.ts
index c702b444c6298..c39eb4623f7fa 100644
--- a/apps/desktop/src/preview/PageDialogs.test.ts
+++ b/apps/desktop/src/preview/PageDialogs.test.ts
@@ -61,4 +61,17 @@ describe("holdPageDialogs", () => {
expect(hold.answer(true)).toBe(false);
expect(callback).not.toHaveBeenCalled();
});
+
+ it("dismisses a pending dialog when a main-frame navigation starts", () => {
+ const { contents, changed, callback } = setup();
+ contents.emit("-run-dialog", info, callback);
+
+ contents.emit("did-start-navigation", { isMainFrame: false, isSameDocument: false });
+ contents.emit("did-start-navigation", { isMainFrame: true, isSameDocument: true });
+ expect(callback).not.toHaveBeenCalled();
+
+ contents.emit("did-start-navigation", { isMainFrame: true, isSameDocument: false });
+ expect(callback).toHaveBeenCalledExactlyOnceWith(false, "");
+ expect(changed).toHaveBeenLastCalledWith(null);
+ });
});
diff --git a/apps/desktop/src/preview/PageDialogs.ts b/apps/desktop/src/preview/PageDialogs.ts
index 96d9feb538f13..96dcbb7b09380 100644
--- a/apps/desktop/src/preview/PageDialogs.ts
+++ b/apps/desktop/src/preview/PageDialogs.ts
@@ -9,9 +9,7 @@ interface RunDialogInfo {
}
export interface PageDialogHold {
- /** Answers the pending dialog; false when none is pending. */
readonly answer: (accept: boolean, promptText?: string) => boolean;
- /** Forgets the pending dialog after something else, such as CDP, closed it. */
readonly closed: () => void;
readonly current: () => DesktopPreviewDialog | null;
}
@@ -53,15 +51,19 @@ export function holdPageDialogs(
contents.off("-run-dialog", listener as (...args: unknown[]) => void);
}
contents.on("-run-dialog", run);
+ const answer = (accept: boolean, promptText?: string) => {
+ const callback = pending;
+ if (callback === null) return false;
+ clear();
+ return deliver(callback, accept, promptText ?? "");
+ };
contents.on("-cancel-dialogs", clear);
- return {
- answer: (accept, promptText) => {
- const callback = pending;
- if (callback === null) return false;
- clear();
- return deliver(callback, accept, promptText ?? "");
+ // Chrome dismisses page dialogs when a navigation starts; a held one would block the commit.
+ contents.on(
+ "did-start-navigation",
+ (event: { readonly isMainFrame: boolean; readonly isSameDocument: boolean }) => {
+ if (event.isMainFrame && !event.isSameDocument) answer(false);
},
- closed: clear,
- current: () => shown,
- };
+ );
+ return { answer, closed: clear, current: () => shown };
}
From 957aa8ff6026324679ace6f0c694dd2184dfd992 Mon Sep 17 00:00:00 2001
From: BelKed <66956532+BelKed@users.noreply.github.com>
Date: Sat, 14 Nov 2026 23:43:33 +0100
Subject: [PATCH 07/13] fix(desktop): closed tab drops its pending dialog
---
apps/desktop/src/preview/Manager.test.ts | 18 +++++++++++++++++-
apps/desktop/src/preview/Manager.ts | 3 ++-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/apps/desktop/src/preview/Manager.test.ts b/apps/desktop/src/preview/Manager.test.ts
index 03ec0f6118e5b..2e9857212a892 100644
--- a/apps/desktop/src/preview/Manager.test.ts
+++ b/apps/desktop/src/preview/Manager.test.ts
@@ -1852,7 +1852,8 @@ describe("PreviewManager", () => {
yield* manager.answerDialog("tab_dialog", true, undefined);
expect(answeredByAgent).not.toHaveBeenCalled();
- guest.emit("-run-dialog", dialogInfo, vi.fn());
+ const replacedAnswer = vi.fn();
+ guest.emit("-run-dialog", dialogInfo, replacedAnswer);
yield* Effect.yieldNow;
const replacement = makeAudioWebContents(43);
fromId.mockReturnValue(replacement.wc);
@@ -1860,6 +1861,21 @@ describe("PreviewManager", () => {
yield* manager.registerWebview("tab_dialog", 43);
yield* Effect.yieldNow;
expect(states.at(-1)?.dialog).toBeUndefined();
+ expect(replacedAnswer).toHaveBeenCalledExactlyOnceWith(false, "");
+
+ const closing = makeAudioWebContents(46);
+ fromId.mockReturnValue(closing.wc);
+ const closingAnswer = vi.fn();
+ yield* manager.createTab("tab_dialog_closed");
+ yield* manager.prepareWebview(closing.wc);
+ yield* manager.registerWebview("tab_dialog_closed", 46);
+ yield* Effect.yieldNow;
+ closing.emit("-run-dialog", dialogInfo, closingAnswer);
+ yield* Effect.yieldNow;
+ yield* manager.closeTab("tab_dialog_closed");
+ yield* Effect.yieldNow;
+ expect(closingAnswer).toHaveBeenCalledExactlyOnceWith(false, "");
+ expect(states.at(-1)?.dialog).toBeUndefined();
const doomed = makeAudioWebContents(44);
fromId.mockReturnValue(doomed.wc);
diff --git a/apps/desktop/src/preview/Manager.ts b/apps/desktop/src/preview/Manager.ts
index caa15fd4cab53..a8af5ddbd42d6 100644
--- a/apps/desktop/src/preview/Manager.ts
+++ b/apps/desktop/src/preview/Manager.ts
@@ -1877,8 +1877,9 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
);
}
const updatedAt = yield* currentIso;
+ const { dialog: _dialog, ...closedWithoutDialog } = closedTab;
const closed: PreviewTabState = {
- ...closedTab,
+ ...closedWithoutDialog,
webContentsId: null,
navStatus: { kind: "Idle" },
canGoBack: false,
From 2e42cb5d03ca76ff6189f25803c44a37543799c8 Mon Sep 17 00:00:00 2001
From: BelKed <66956532+BelKed@users.noreply.github.com>
Date: Sun, 15 Nov 2026 04:27:29 +0100
Subject: [PATCH 08/13] fix(desktop): tab dialog follows the live hold
---
apps/desktop/src/preview/Manager.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/desktop/src/preview/Manager.ts b/apps/desktop/src/preview/Manager.ts
index a8af5ddbd42d6..557bc40620c8d 100644
--- a/apps/desktop/src/preview/Manager.ts
+++ b/apps/desktop/src/preview/Manager.ts
@@ -966,13 +966,13 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
const syncTabDialog = Effect.fn("PreviewManager.syncTabDialog")(function* (
wc: Electron.WebContents,
- dialog: DesktopPreviewDialog | null,
) {
const updatedAt = yield* currentIso;
const next = yield* SynchronizedRef.modify(tabsRef, (tabs) => {
const entry = [...tabs].find(([, tab]) => tab.webContentsId === wc.id);
if (!entry) return [Option.none
(), tabs] as const;
const [tabId, current] = entry;
+ const dialog = dialogHolds.get(wc.id)?.current();
const { dialog: _dialog, ...withoutDialog } = current;
const state: PreviewTabState = {
...withoutDialog,
@@ -993,7 +993,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
if (dialogHolds.has(wc.id)) return;
dialogHolds.set(
wc.id,
- holdPageDialogs(wc, (dialog) => runFork(syncTabDialog(wc, dialog))),
+ holdPageDialogs(wc, () => runFork(syncTabDialog(wc))),
);
};
From 99ac9962375ed623cbbf9fcb078dcbba72d6af30 Mon Sep 17 00:00:00 2001
From: BelKed <66956532+BelKed@users.noreply.github.com>
Date: Sun, 15 Nov 2026 09:22:40 +0100
Subject: [PATCH 09/13] fix(desktop): prompt keeps Electron's rejection
---
apps/desktop/src/preview/PageDialogs.test.ts | 22 +++++++++++++++++++-
apps/desktop/src/preview/PageDialogs.ts | 5 +++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/apps/desktop/src/preview/PageDialogs.test.ts b/apps/desktop/src/preview/PageDialogs.test.ts
index c39eb4623f7fa..0495785f9f8eb 100644
--- a/apps/desktop/src/preview/PageDialogs.test.ts
+++ b/apps/desktop/src/preview/PageDialogs.test.ts
@@ -32,7 +32,7 @@ describe("holdPageDialogs", () => {
it("answers the page once and clears the dialog", () => {
const { contents, changed, hold, callback } = setup();
- contents.emit("-run-dialog", { ...info, dialogType: "prompt" }, callback);
+ contents.emit("-run-dialog", info, callback);
expect(hold.answer(true, "yes")).toBe(true);
expect(hold.answer(false)).toBe(false);
@@ -47,6 +47,26 @@ describe("holdPageDialogs", () => {
expect(first).toHaveBeenCalledExactlyOnceWith(false, "");
});
+ // A frame without the renderer prompt override reaches the hold
+ it("rejects a prompt at once like Electron and leaves a pending dialog alone", () => {
+ const { contents, changed, hold, callback } = setup();
+ contents.emit("-run-dialog", info, callback);
+ changed.mockClear();
+
+ const prompt = vi.fn();
+ contents.emit("-run-dialog", { ...info, dialogType: "prompt" }, prompt);
+
+ expect(prompt).toHaveBeenCalledExactlyOnceWith(false, "");
+ expect(changed).not.toHaveBeenCalled();
+ expect(hold.current()).toEqual({ type: "confirm", message: "Delete it?", defaultValue: "" });
+ expect(callback).not.toHaveBeenCalled();
+ expect(hold.answer(true)).toBe(true);
+ expect(callback).toHaveBeenCalledExactlyOnceWith(true, "");
+
+ contents.emit("-run-dialog", { ...info, dialogType: "prompt" }, prompt);
+ expect(hold.current()).toBeNull();
+ });
+
it("drops a dialog that CDP or a navigation already closed without answering twice", () => {
const { contents, changed, hold, callback } = setup();
diff --git a/apps/desktop/src/preview/PageDialogs.ts b/apps/desktop/src/preview/PageDialogs.ts
index 96dcbb7b09380..314eb6272f0be 100644
--- a/apps/desktop/src/preview/PageDialogs.ts
+++ b/apps/desktop/src/preview/PageDialogs.ts
@@ -16,6 +16,7 @@ export interface PageDialogHold {
// Electron shows page dialogs as a native app-modal box from the `-run-dialog` event and never
// closes it when CDP answers. Replacing that listener keeps the dialog pending for the tab's UI.
+// Electron does not support `prompt()` and rejects it at once; we keep that.
export function holdPageDialogs(
contents: NodeJS.EventEmitter,
changed: (dialog: DesktopPreviewDialog | null) => void,
@@ -37,6 +38,10 @@ export function holdPageDialogs(
}
};
const run = (info: RunDialogInfo, callback: DialogCallback) => {
+ if (info.dialogType === "prompt") {
+ deliver(callback, false, "");
+ return;
+ }
const previous = pending;
if (previous !== null) deliver(previous, false, "");
pending = callback;
From c6a047ba1166e3b29b975082c002acc152b9c568 Mon Sep 17 00:00:00 2001
From: BelKed <66956532+BelKed@users.noreply.github.com>
Date: Mon, 16 Nov 2026 20:36:44 +0100
Subject: [PATCH 10/13] fix(web): browser dialog card matches the app alert
dialog
---
apps/web/src/browser/BrowserDialogCard.tsx | 127 ++++++++++++++----
apps/web/src/browser/ServerBrowserSurface.tsx | 3 +
.../src/components/preview/PreviewView.tsx | 2 +
.../preview/ThreadPreviewMiniPlayer.tsx | 1 +
apps/web/src/components/ui/alert-dialog.tsx | 21 ++-
apps/web/src/components/ui/dialog-styles.ts | 14 ++
6 files changed, 132 insertions(+), 36 deletions(-)
diff --git a/apps/web/src/browser/BrowserDialogCard.tsx b/apps/web/src/browser/BrowserDialogCard.tsx
index 88583a661b2fa..59de8f2ebd81a 100644
--- a/apps/web/src/browser/BrowserDialogCard.tsx
+++ b/apps/web/src/browser/BrowserDialogCard.tsx
@@ -1,10 +1,32 @@
-import { useState } from "react";
+import { type CSSProperties, type KeyboardEvent, useId, useState } from "react";
import { Button } from "~/components/ui/button";
+import {
+ ALERT_DIALOG_DESCRIPTION_CLASS,
+ ALERT_DIALOG_FOOTER_CLASS,
+ ALERT_DIALOG_FOOTER_DEFAULT_CLASS,
+ ALERT_DIALOG_HEADER_CLASS,
+ ALERT_DIALOG_TITLE_CLASS,
+ DIALOG_BACKDROP_CLASS,
+ DIALOG_POPUP_CLASS,
+} from "~/components/ui/dialog-styles";
import { Input } from "~/components/ui/input";
+import { cn } from "~/lib/utils";
+function hostOf(url: string | undefined): string {
+ if (!url) return "";
+ try {
+ return new URL(url).host;
+ } catch {
+ return "";
+ }
+}
+
+// The app's alert dialog, scoped to the browser panel: it never takes focus and the rest of the app stays usable.
+// Panels under 20rem tall (the mini player) get tighter padding, and the header scrolls as a whole.
export function BrowserDialogCard({
dialog,
+ url,
canAnswer,
onAnswer,
}: {
@@ -13,41 +35,96 @@ export function BrowserDialogCard({
readonly message: string;
readonly defaultValue: string;
};
+ readonly url?: string | undefined;
readonly canAnswer: boolean;
readonly onAnswer: (accept: boolean, promptText?: string) => void;
}) {
const [promptText, setPromptText] = useState(dialog.defaultValue);
+ const titleId = useId();
+ const descriptionId = useId();
+ const host = hostOf(url);
+ const isPrompt = dialog.type === "prompt";
+ const accept = () => onAnswer(true, isPrompt ? promptText : undefined);
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (!canAnswer || event.repeat || event.nativeEvent.isComposing) return;
+ if (event.key === "Escape") {
+ event.preventDefault();
+ event.stopPropagation();
+ onAnswer(false);
+ } else if (event.key === "Enter" && !(event.target instanceof HTMLButtonElement)) {
+ event.preventDefault();
+ event.stopPropagation();
+ accept();
+ }
+ };
return (
-
-
{dialog.message}
- {canAnswer ? (
- <>
- {dialog.type === "prompt" ? (
+
+
+
+
+ {host ? (
+
+ {host}
+
+ ) : null}
+
+ {dialog.message}
+
+
+ {isPrompt && canAnswer ? (
+
setPromptText(event.target.value)}
/>
- ) : null}
-
-
-
- >
- ) : (
-
Take control to respond.
- )}
+ ) : null}
+
+ {canAnswer ? (
+ <>
+ {dialog.type === "alert" ? null : (
+
+ )}
+
+ >
+ ) : (
+
Take control to respond.
+ )}
+
+
);
}
diff --git a/apps/web/src/browser/ServerBrowserSurface.tsx b/apps/web/src/browser/ServerBrowserSurface.tsx
index 6d87bc393be11..b66faafd7193d 100644
--- a/apps/web/src/browser/ServerBrowserSurface.tsx
+++ b/apps/web/src/browser/ServerBrowserSurface.tsx
@@ -153,6 +153,7 @@ export function ServerBrowserSurface(props: {
readonly onPopup?: (tabId: string) => void;
readonly className?: string;
readonly pdfUrl?: string | null;
+ readonly pageUrl?: string;
readonly ref?: Ref
;
}) {
const {
@@ -168,6 +169,7 @@ export function ServerBrowserSurface(props: {
onPopup,
className,
pdfUrl = null,
+ pageUrl,
ref,
} = props;
const canvasRef = useRef(null);
@@ -853,6 +855,7 @@ export function ServerBrowserSurface(props: {
send({ type: "dialog", accept, ...(promptText === undefined ? {} : { promptText }) })
diff --git a/apps/web/src/components/preview/PreviewView.tsx b/apps/web/src/components/preview/PreviewView.tsx
index 82b7dfb1fd038..3a9d2186c4358 100644
--- a/apps/web/src/components/preview/PreviewView.tsx
+++ b/apps/web/src/components/preview/PreviewView.tsx
@@ -1092,6 +1092,7 @@ export function PreviewView({
? previewPdfAssetUrl(url, environmentHttpBaseUrl)
: null
}
+ pageUrl={url}
visible={visible}
onFirstFrame={() => setServerFrameTabId(runtimeTabId)}
onControl={(control) =>
@@ -1133,6 +1134,7 @@ export function PreviewView({
void previewBridge
diff --git a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
index 3e4dba8d879ca..b84157a3f1a3e 100644
--- a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
+++ b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
@@ -320,6 +320,7 @@ function BrowserMiniPlayer({ threadRef, tabId, miniPlayer }: Props & { readonly
threadId={threadRef.threadId}
tabId={tabId}
pdfUrl={pdfUrl}
+ pageUrl={snapshot.navStatus._tag === "Idle" ? "" : snapshot.navStatus.url}
visible
followSize={false}
controlPosition="bottom"
diff --git a/apps/web/src/components/ui/alert-dialog.tsx b/apps/web/src/components/ui/alert-dialog.tsx
index 909fe8905fc3d..15b84efdeff36 100644
--- a/apps/web/src/components/ui/alert-dialog.tsx
+++ b/apps/web/src/components/ui/alert-dialog.tsx
@@ -3,6 +3,11 @@ import { useRender } from "@base-ui/react/use-render";
import { cn } from "~/lib/utils";
import {
+ ALERT_DIALOG_DESCRIPTION_CLASS,
+ ALERT_DIALOG_FOOTER_CLASS,
+ ALERT_DIALOG_FOOTER_DEFAULT_CLASS,
+ ALERT_DIALOG_HEADER_CLASS,
+ ALERT_DIALOG_TITLE_CLASS,
DIALOG_BACKDROP_CLASS,
DIALOG_MOBILE_SHEET_CLASS,
DIALOG_POPUP_CLASS,
@@ -90,10 +95,7 @@ function AlertDialogPopup({
function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
@@ -110,8 +112,8 @@ function AlertDialogFooter({
return (
@@ -134,10 +136,7 @@ function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Pr
function AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props) {
return (
diff --git a/apps/web/src/components/ui/dialog-styles.ts b/apps/web/src/components/ui/dialog-styles.ts
index f2eeae928e995..a9bbcc17b9d3e 100644
--- a/apps/web/src/components/ui/dialog-styles.ts
+++ b/apps/web/src/components/ui/dialog-styles.ts
@@ -10,10 +10,24 @@ const DIALOG_POPUP_BASE_CLASS =
const DIALOG_POPUP_CLASS = `dialog-glass ${DIALOG_POPUP_BASE_CLASS} rounded-2xl border`;
const DIALOG_MEDIA_POPUP_CLASS = `${DIALOG_POPUP_BASE_CLASS} max-h-[92vh] w-auto max-w-[92vw] overflow-visible rounded-none border border-transparent bg-transparent p-0 shadow-none`;
+const ALERT_DIALOG_HEADER_CLASS =
+ "flex min-h-0 flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left";
+const ALERT_DIALOG_FOOTER_CLASS =
+ "flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]";
+const ALERT_DIALOG_FOOTER_DEFAULT_CLASS = "border-t bg-muted/72 py-4";
+const ALERT_DIALOG_TITLE_CLASS = "wrap-anywhere shrink-0 font-semibold text-xl leading-snug";
+const ALERT_DIALOG_DESCRIPTION_CLASS =
+ "wrap-anywhere max-h-[min(24rem,60dvh)] min-h-0 overflow-y-auto overscroll-contain text-muted-foreground text-sm select-text";
+
const DIALOG_MOBILE_SHEET_CLASS =
"max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4";
export {
+ ALERT_DIALOG_DESCRIPTION_CLASS,
+ ALERT_DIALOG_FOOTER_CLASS,
+ ALERT_DIALOG_FOOTER_DEFAULT_CLASS,
+ ALERT_DIALOG_HEADER_CLASS,
+ ALERT_DIALOG_TITLE_CLASS,
DIALOG_BACKDROP_CLASS,
DIALOG_MEDIA_BACKDROP_CLASS,
DIALOG_MOBILE_SHEET_CLASS,
From 2a7c0f6c05853c41c8d4232bb040341ec9337a67 Mon Sep 17 00:00:00 2001
From: Julius Marminge
Date: Mon, 16 Nov 2026 20:05:48 +0000
Subject: [PATCH 11/13] fix(desktop): page dialog answers apply only to the
dialog they were for
Each held page dialog now carries an id, and the Browser panel answers
by that id, so an answer that arrives after an agent closed a dialog no
longer answers the next one the page opens. Desktop always rejects
prompt(), so the IPC no longer carries prompt text.
Revert the restyle of the browser dialog card: the desktop panel reuses
the streamed browser's existing card as it looks today, and the alert
dialog classes stay where they were.
Co-Authored-By: Claude Opus 5.5
---
apps/desktop/src/ipc/methods/preview.ts | 4 +-
apps/desktop/src/preload.ts | 8 +-
apps/desktop/src/preview/Manager.test.ts | 14 +-
apps/desktop/src/preview/Manager.ts | 6 +-
apps/desktop/src/preview/PageDialogs.test.ts | 25 ++--
apps/desktop/src/preview/PageDialogs.ts | 12 +-
apps/web/src/browser/BrowserDialogCard.tsx | 131 ++++--------------
apps/web/src/browser/ServerBrowserSurface.tsx | 3 -
.../src/components/preview/PreviewView.tsx | 14 +-
.../preview/ThreadPreviewMiniPlayer.tsx | 1 -
apps/web/src/components/ui/alert-dialog.tsx | 21 +--
apps/web/src/components/ui/dialog-styles.ts | 14 --
apps/web/src/previewStateStore.test.ts | 2 +-
apps/web/src/previewStateStore.ts | 4 +-
packages/contracts/src/ipc.ts | 5 +-
15 files changed, 94 insertions(+), 170 deletions(-)
diff --git a/apps/desktop/src/ipc/methods/preview.ts b/apps/desktop/src/ipc/methods/preview.ts
index bbba5a454ff7a..557f4f3c5b6f2 100644
--- a/apps/desktop/src/ipc/methods/preview.ts
+++ b/apps/desktop/src/ipc/methods/preview.ts
@@ -231,9 +231,9 @@ const answerDialog = DesktopIpc.makeIpcMethod({
channel: IpcChannels.PREVIEW_ANSWER_DIALOG_CHANNEL,
payload: DesktopPreviewAnswerDialogInputSchema,
result: Schema.Void,
- handler: Effect.fn("desktop.ipc.preview.answerDialog")(function* ({ tabId, accept, promptText }) {
+ handler: Effect.fn("desktop.ipc.preview.answerDialog")(function* ({ tabId, dialogId, accept }) {
const manager = yield* PreviewManager.PreviewManager;
- yield* manager.answerDialog(tabId, accept, promptText);
+ yield* manager.answerDialog(tabId, dialogId, accept);
}),
});
const setShown = DesktopIpc.makeIpcMethod({
diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.ts
index 3527f6d92acde..e7fa11e056822 100644
--- a/apps/desktop/src/preload.ts
+++ b/apps/desktop/src/preload.ts
@@ -404,12 +404,8 @@ contextBridge.exposeInMainWorld("desktopBridge", {
ipcRenderer.invoke(IpcChannels.PREVIEW_SET_COLOR_SCHEME_CHANNEL, { tabId, colorScheme }),
setAudioMuted: (tabId, audioMuted) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_SET_AUDIO_MUTED_CHANNEL, { tabId, audioMuted }),
- answerDialog: (tabId, accept, promptText) =>
- ipcRenderer.invoke(IpcChannels.PREVIEW_ANSWER_DIALOG_CHANNEL, {
- tabId,
- accept,
- ...(promptText === undefined ? {} : { promptText }),
- }),
+ answerDialog: (tabId, dialogId, accept) =>
+ ipcRenderer.invoke(IpcChannels.PREVIEW_ANSWER_DIALOG_CHANNEL, { tabId, dialogId, accept }),
findInPage: (tabId, text, { forward, newSession }) =>
ipcRenderer.invoke(IpcChannels.PREVIEW_FIND_IN_PAGE_CHANNEL, {
tabId,
diff --git a/apps/desktop/src/preview/Manager.test.ts b/apps/desktop/src/preview/Manager.test.ts
index 93bc996c2dc19..dcd329c6ffad2 100644
--- a/apps/desktop/src/preview/Manager.test.ts
+++ b/apps/desktop/src/preview/Manager.test.ts
@@ -1833,13 +1833,14 @@ describe("PreviewManager", () => {
guest.emit("-run-dialog", dialogInfo, answer);
yield* Effect.yieldNow;
expect(states.at(-1)?.dialog).toEqual({
+ id: 1,
type: "confirm",
message: "Delete it?",
defaultValue: "",
});
expect(answer).not.toHaveBeenCalled();
- yield* manager.answerDialog("tab_dialog", true, undefined);
+ yield* manager.answerDialog("tab_dialog", 1, true);
yield* Effect.yieldNow;
expect(answer).toHaveBeenCalledExactlyOnceWith(true, "");
expect(states.at(-1)?.dialog).toBeUndefined();
@@ -1850,7 +1851,7 @@ describe("PreviewManager", () => {
guest.emitDebuggerMessage("Page.javascriptDialogClosed");
yield* Effect.yieldNow;
expect(states.at(-1)?.dialog).toBeUndefined();
- yield* manager.answerDialog("tab_dialog", true, undefined);
+ yield* manager.answerDialog("tab_dialog", 2, true);
expect(answeredByAgent).not.toHaveBeenCalled();
const replacedAnswer = vi.fn();
@@ -1919,9 +1920,14 @@ describe("PreviewManager", () => {
yield* Effect.yieldNow;
expect(native).not.toHaveBeenCalled();
- expect(states.at(-1)?.dialog).toEqual({ type: "alert", message: "Hi", defaultValue: "" });
+ expect(states.at(-1)?.dialog).toEqual({
+ id: 1,
+ type: "alert",
+ message: "Hi",
+ defaultValue: "",
+ });
- yield* manager.answerDialog("tab_dialog_early", true, undefined);
+ yield* manager.answerDialog("tab_dialog_early", 1, true);
expect(answer).toHaveBeenCalledExactlyOnceWith(true, "");
}),
),
diff --git a/apps/desktop/src/preview/Manager.ts b/apps/desktop/src/preview/Manager.ts
index 557796e4c9085..2fc66cb60e1fa 100644
--- a/apps/desktop/src/preview/Manager.ts
+++ b/apps/desktop/src/preview/Manager.ts
@@ -2732,8 +2732,8 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
const answerDialog = Effect.fn("PreviewManager.answerDialog")(function* (
tabId: string,
+ dialogId: number,
accept: boolean,
- promptText: string | undefined,
) {
const tab = (yield* SynchronizedRef.get(tabsRef)).get(tabId);
if (!tab) {
@@ -2742,7 +2742,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
const webContentsId = tab.webContentsId;
if (webContentsId === null) return;
yield* attempt({ operation: "answerDialog", tabId, webContentsId }, () =>
- dialogHolds.get(webContentsId)?.answer(accept, promptText),
+ dialogHolds.get(webContentsId)?.answer(accept, dialogId),
);
});
@@ -4009,8 +4009,8 @@ export class PreviewManager extends Context.Service<
) => Effect.Effect;
readonly answerDialog: (
tabId: string,
+ dialogId: number,
accept: boolean,
- promptText: string | undefined,
) => Effect.Effect;
readonly setShown: (tabId: string, shown: boolean) => Effect.Effect;
readonly setCaptureDrawn: (tabId: string, drawn: boolean) => Effect.Effect;
diff --git a/apps/desktop/src/preview/PageDialogs.test.ts b/apps/desktop/src/preview/PageDialogs.test.ts
index 0495785f9f8eb..9c63f8f3aea9c 100644
--- a/apps/desktop/src/preview/PageDialogs.test.ts
+++ b/apps/desktop/src/preview/PageDialogs.test.ts
@@ -24,27 +24,29 @@ describe("holdPageDialogs", () => {
expect(native).not.toHaveBeenCalled();
expect(callback).not.toHaveBeenCalled();
expect(changed).toHaveBeenLastCalledWith({
+ id: 1,
type: "confirm",
message: "Delete it?",
defaultValue: "",
});
});
- it("answers the page once and clears the dialog", () => {
+ it("answers only the dialog it was meant for, once", () => {
const { contents, changed, hold, callback } = setup();
contents.emit("-run-dialog", info, callback);
- expect(hold.answer(true, "yes")).toBe(true);
+ expect(hold.answer(true, 1)).toBe(true);
expect(hold.answer(false)).toBe(false);
-
- expect(callback).toHaveBeenCalledOnce();
- expect(callback).toHaveBeenCalledWith(true, "yes");
+ expect(callback).toHaveBeenCalledExactlyOnceWith(true, "");
expect(changed).toHaveBeenLastCalledWith(null);
- const first = vi.fn();
- contents.emit("-run-dialog", info, first);
+ const next = vi.fn();
+ contents.emit("-run-dialog", info, next);
+ expect(hold.answer(true, 1)).toBe(false);
+ expect(next).not.toHaveBeenCalled();
+
contents.emit("-run-dialog", info, callback);
- expect(first).toHaveBeenCalledExactlyOnceWith(false, "");
+ expect(next).toHaveBeenCalledExactlyOnceWith(false, "");
});
// A frame without the renderer prompt override reaches the hold
@@ -58,7 +60,12 @@ describe("holdPageDialogs", () => {
expect(prompt).toHaveBeenCalledExactlyOnceWith(false, "");
expect(changed).not.toHaveBeenCalled();
- expect(hold.current()).toEqual({ type: "confirm", message: "Delete it?", defaultValue: "" });
+ expect(hold.current()).toEqual({
+ id: 1,
+ type: "confirm",
+ message: "Delete it?",
+ defaultValue: "",
+ });
expect(callback).not.toHaveBeenCalled();
expect(hold.answer(true)).toBe(true);
expect(callback).toHaveBeenCalledExactlyOnceWith(true, "");
diff --git a/apps/desktop/src/preview/PageDialogs.ts b/apps/desktop/src/preview/PageDialogs.ts
index 314eb6272f0be..5612ed4925af9 100644
--- a/apps/desktop/src/preview/PageDialogs.ts
+++ b/apps/desktop/src/preview/PageDialogs.ts
@@ -9,7 +9,8 @@ interface RunDialogInfo {
}
export interface PageDialogHold {
- readonly answer: (accept: boolean, promptText?: string) => boolean;
+ /** Answers the pending dialog; with `id`, only when it is still that dialog. */
+ readonly answer: (accept: boolean, id?: number) => boolean;
readonly closed: () => void;
readonly current: () => DesktopPreviewDialog | null;
}
@@ -22,6 +23,7 @@ export function holdPageDialogs(
changed: (dialog: DesktopPreviewDialog | null) => void,
): PageDialogHold {
let pending: DialogCallback | null = null;
+ let nextId = 0;
let shown: DesktopPreviewDialog | null = null;
const clear = () => {
if (pending === null) return;
@@ -45,7 +47,9 @@ export function holdPageDialogs(
const previous = pending;
if (previous !== null) deliver(previous, false, "");
pending = callback;
+ nextId += 1;
shown = {
+ id: nextId,
type: info.dialogType,
message: info.messageText,
defaultValue: info.defaultPromptText,
@@ -56,11 +60,11 @@ export function holdPageDialogs(
contents.off("-run-dialog", listener as (...args: unknown[]) => void);
}
contents.on("-run-dialog", run);
- const answer = (accept: boolean, promptText?: string) => {
+ const answer = (accept: boolean, id?: number) => {
const callback = pending;
- if (callback === null) return false;
+ if (callback === null || (id !== undefined && shown?.id !== id)) return false;
clear();
- return deliver(callback, accept, promptText ?? "");
+ return deliver(callback, accept, "");
};
contents.on("-cancel-dialogs", clear);
// Chrome dismisses page dialogs when a navigation starts; a held one would block the commit.
diff --git a/apps/web/src/browser/BrowserDialogCard.tsx b/apps/web/src/browser/BrowserDialogCard.tsx
index 59de8f2ebd81a..72a4fc2589dd1 100644
--- a/apps/web/src/browser/BrowserDialogCard.tsx
+++ b/apps/web/src/browser/BrowserDialogCard.tsx
@@ -1,130 +1,59 @@
-import { type CSSProperties, type KeyboardEvent, useId, useState } from "react";
+import { useState } from "react";
import { Button } from "~/components/ui/button";
-import {
- ALERT_DIALOG_DESCRIPTION_CLASS,
- ALERT_DIALOG_FOOTER_CLASS,
- ALERT_DIALOG_FOOTER_DEFAULT_CLASS,
- ALERT_DIALOG_HEADER_CLASS,
- ALERT_DIALOG_TITLE_CLASS,
- DIALOG_BACKDROP_CLASS,
- DIALOG_POPUP_CLASS,
-} from "~/components/ui/dialog-styles";
import { Input } from "~/components/ui/input";
import { cn } from "~/lib/utils";
-function hostOf(url: string | undefined): string {
- if (!url) return "";
- try {
- return new URL(url).host;
- } catch {
- return "";
- }
-}
-
-// The app's alert dialog, scoped to the browser panel: it never takes focus and the rest of the app stays usable.
-// Panels under 20rem tall (the mini player) get tighter padding, and the header scrolls as a whole.
export function BrowserDialogCard({
dialog,
- url,
canAnswer,
onAnswer,
+ className,
}: {
readonly dialog: {
readonly type: string;
readonly message: string;
readonly defaultValue: string;
};
- readonly url?: string | undefined;
readonly canAnswer: boolean;
readonly onAnswer: (accept: boolean, promptText?: string) => void;
+ readonly className?: string;
}) {
const [promptText, setPromptText] = useState(dialog.defaultValue);
- const titleId = useId();
- const descriptionId = useId();
- const host = hostOf(url);
- const isPrompt = dialog.type === "prompt";
- const accept = () => onAnswer(true, isPrompt ? promptText : undefined);
- const handleKeyDown = (event: KeyboardEvent) => {
- if (!canAnswer || event.repeat || event.nativeEvent.isComposing) return;
- if (event.key === "Escape") {
- event.preventDefault();
- event.stopPropagation();
- onAnswer(false);
- } else if (event.key === "Enter" && !(event.target instanceof HTMLButtonElement)) {
- event.preventDefault();
- event.stopPropagation();
- accept();
- }
- };
return (
-
-
-
-
- {host ? (
-
- {host}
-
- ) : null}
-
- {dialog.message}
-
-
- {isPrompt && canAnswer ? (
-
+
+
{dialog.message}
+ {canAnswer ? (
+ <>
+ {dialog.type === "prompt" ? (
setPromptText(event.target.value)}
/>
+ ) : null}
+
+
+
- ) : null}
-
- {canAnswer ? (
- <>
- {dialog.type === "alert" ? null : (
-
- )}
-
- >
- ) : (
-
Take control to respond.
- )}
-
-
+ >
+ ) : (
+
Take control to respond.
+ )}
);
}
diff --git a/apps/web/src/browser/ServerBrowserSurface.tsx b/apps/web/src/browser/ServerBrowserSurface.tsx
index b66faafd7193d..6d87bc393be11 100644
--- a/apps/web/src/browser/ServerBrowserSurface.tsx
+++ b/apps/web/src/browser/ServerBrowserSurface.tsx
@@ -153,7 +153,6 @@ export function ServerBrowserSurface(props: {
readonly onPopup?: (tabId: string) => void;
readonly className?: string;
readonly pdfUrl?: string | null;
- readonly pageUrl?: string;
readonly ref?: Ref
;
}) {
const {
@@ -169,7 +168,6 @@ export function ServerBrowserSurface(props: {
onPopup,
className,
pdfUrl = null,
- pageUrl,
ref,
} = props;
const canvasRef = useRef(null);
@@ -855,7 +853,6 @@ export function ServerBrowserSurface(props: {
send({ type: "dialog", accept, ...(promptText === undefined ? {} : { promptText }) })
diff --git a/apps/web/src/components/preview/PreviewView.tsx b/apps/web/src/components/preview/PreviewView.tsx
index 1ae90e6ab0c77..31351822fcb3b 100644
--- a/apps/web/src/components/preview/PreviewView.tsx
+++ b/apps/web/src/components/preview/PreviewView.tsx
@@ -251,6 +251,7 @@ export function PreviewView({
const serverStreamPending =
isServerTab && !showEmptyState && !isUnreachable && serverFrameTabId !== runtimeTabId;
const controller = desktopOverlay?.controller ?? "none";
+ const pageDialog = desktopOverlay?.dialog;
const viewport = snapshot?.viewport ?? FILL_PREVIEW_VIEWPORT;
const browserDefaults = useBrowserDefaults();
// IPC interprets undefined profile ids as all profiles.
@@ -1094,7 +1095,6 @@ export function PreviewView({
? previewPdfAssetUrl(url, environmentHttpBaseUrl)
: null
}
- pageUrl={url}
visible={visible}
onFirstFrame={() => setServerFrameTabId(runtimeTabId)}
onControl={(control) =>
@@ -1132,15 +1132,15 @@ export function PreviewView({
onOpenUrl={(next) => void handleOpenServerUrl(next)}
/>
) : null}
- {desktopOverlay?.dialog && runtimeTabId ? (
+ {pageDialog && runtimeTabId ? (
+ className="z-40"
+ onAnswer={(accept) =>
void previewBridge
- ?.answerDialog(runtimeTabId, accept, promptText)
+ ?.answerDialog(runtimeTabId, pageDialog.id, accept)
.catch(() => undefined)
}
/>
diff --git a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
index b84157a3f1a3e..3e4dba8d879ca 100644
--- a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
+++ b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
@@ -320,7 +320,6 @@ function BrowserMiniPlayer({ threadRef, tabId, miniPlayer }: Props & { readonly
threadId={threadRef.threadId}
tabId={tabId}
pdfUrl={pdfUrl}
- pageUrl={snapshot.navStatus._tag === "Idle" ? "" : snapshot.navStatus.url}
visible
followSize={false}
controlPosition="bottom"
diff --git a/apps/web/src/components/ui/alert-dialog.tsx b/apps/web/src/components/ui/alert-dialog.tsx
index 15b84efdeff36..909fe8905fc3d 100644
--- a/apps/web/src/components/ui/alert-dialog.tsx
+++ b/apps/web/src/components/ui/alert-dialog.tsx
@@ -3,11 +3,6 @@ import { useRender } from "@base-ui/react/use-render";
import { cn } from "~/lib/utils";
import {
- ALERT_DIALOG_DESCRIPTION_CLASS,
- ALERT_DIALOG_FOOTER_CLASS,
- ALERT_DIALOG_FOOTER_DEFAULT_CLASS,
- ALERT_DIALOG_HEADER_CLASS,
- ALERT_DIALOG_TITLE_CLASS,
DIALOG_BACKDROP_CLASS,
DIALOG_MOBILE_SHEET_CLASS,
DIALOG_POPUP_CLASS,
@@ -95,7 +90,10 @@ function AlertDialogPopup({
function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
@@ -112,8 +110,8 @@ function AlertDialogFooter({
return (
@@ -136,7 +134,10 @@ function AlertDialogTitle({ className, ...props }: AlertDialogPrimitive.Title.Pr
function AlertDialogDescription({ className, ...props }: AlertDialogPrimitive.Description.Props) {
return (
diff --git a/apps/web/src/components/ui/dialog-styles.ts b/apps/web/src/components/ui/dialog-styles.ts
index a9bbcc17b9d3e..f2eeae928e995 100644
--- a/apps/web/src/components/ui/dialog-styles.ts
+++ b/apps/web/src/components/ui/dialog-styles.ts
@@ -10,24 +10,10 @@ const DIALOG_POPUP_BASE_CLASS =
const DIALOG_POPUP_CLASS = `dialog-glass ${DIALOG_POPUP_BASE_CLASS} rounded-2xl border`;
const DIALOG_MEDIA_POPUP_CLASS = `${DIALOG_POPUP_BASE_CLASS} max-h-[92vh] w-auto max-w-[92vw] overflow-visible rounded-none border border-transparent bg-transparent p-0 shadow-none`;
-const ALERT_DIALOG_HEADER_CLASS =
- "flex min-h-0 flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left";
-const ALERT_DIALOG_FOOTER_CLASS =
- "flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]";
-const ALERT_DIALOG_FOOTER_DEFAULT_CLASS = "border-t bg-muted/72 py-4";
-const ALERT_DIALOG_TITLE_CLASS = "wrap-anywhere shrink-0 font-semibold text-xl leading-snug";
-const ALERT_DIALOG_DESCRIPTION_CLASS =
- "wrap-anywhere max-h-[min(24rem,60dvh)] min-h-0 overflow-y-auto overscroll-contain text-muted-foreground text-sm select-text";
-
const DIALOG_MOBILE_SHEET_CLASS =
"max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4";
export {
- ALERT_DIALOG_DESCRIPTION_CLASS,
- ALERT_DIALOG_FOOTER_CLASS,
- ALERT_DIALOG_FOOTER_DEFAULT_CLASS,
- ALERT_DIALOG_HEADER_CLASS,
- ALERT_DIALOG_TITLE_CLASS,
DIALOG_BACKDROP_CLASS,
DIALOG_MEDIA_BACKDROP_CLASS,
DIALOG_MOBILE_SHEET_CLASS,
diff --git a/apps/web/src/previewStateStore.test.ts b/apps/web/src/previewStateStore.test.ts
index d72139d374373..0686208aa307a 100644
--- a/apps/web/src/previewStateStore.test.ts
+++ b/apps/web/src/previewStateStore.test.ts
@@ -208,7 +208,7 @@ describe("previewStateStore (single-tab)", () => {
...loaded,
navStatus: { ...loaded.navStatus, url: "https://example.com/next" },
});
- const dialog = { type: "confirm", message: "Delete it?", defaultValue: "" };
+ const dialog = { id: 1, type: "confirm", message: "Delete it?", defaultValue: "" };
applyPreviewDesktopState(ref, snapshot.tabId, { ...loaded, dialog });
applyPreviewDesktopState(ref, snapshot.tabId, { ...loaded, dialog: { ...dialog } });
applyPreviewDesktopState(ref, snapshot.tabId, loaded);
diff --git a/apps/web/src/previewStateStore.ts b/apps/web/src/previewStateStore.ts
index 9d1ece685b45d..ced5c6289a6c3 100644
--- a/apps/web/src/previewStateStore.ts
+++ b/apps/web/src/previewStateStore.ts
@@ -412,9 +412,7 @@ function isPreviewStateEqual(
previous.audioMuted === next.audioMuted &&
previous.audible === next.audible &&
previous.controller === next.controller &&
- previous.dialog?.type === next.dialog?.type &&
- previous.dialog?.message === next.dialog?.message &&
- previous.dialog?.defaultValue === next.dialog?.defaultValue &&
+ previous.dialog?.id === next.dialog?.id &&
previous.favicon?.dataUrl === next.favicon?.dataUrl &&
previous.favicon?.pageUrl === next.favicon?.pageUrl &&
previous.favicon?.capturedAt === next.favicon?.capturedAt)
diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts
index abc21ac8033d4..262a094767de7 100644
--- a/packages/contracts/src/ipc.ts
+++ b/packages/contracts/src/ipc.ts
@@ -604,6 +604,7 @@ export interface DesktopPreviewFavicon {
}
export interface DesktopPreviewDialog {
+ id: number;
type: string;
message: string;
defaultValue: string;
@@ -1027,8 +1028,8 @@ export const DesktopPreviewSetAudioMutedInputSchema = Schema.Struct({
export const DesktopPreviewAnswerDialogInputSchema = Schema.Struct({
tabId: DesktopPreviewTabIdSchema,
+ dialogId: Schema.Number,
accept: Schema.Boolean,
- promptText: Schema.optional(Schema.String),
});
export const DesktopPreviewSetShownInputSchema = Schema.Struct({
@@ -1300,7 +1301,7 @@ export interface DesktopPreviewBridge {
hardReload: (tabId: string) => Promise;
setColorScheme: (tabId: string, colorScheme: DesktopPreviewColorScheme) => Promise;
setAudioMuted: (tabId: string, audioMuted: boolean) => Promise;
- answerDialog: (tabId: string, accept: boolean, promptText?: string) => Promise;
+ answerDialog: (tabId: string, dialogId: number, accept: boolean) => Promise;
findInPage: (
tabId: string,
text: string,
From 2e4d005356f58d966c016045df1f9be64483ff99 Mon Sep 17 00:00:00 2001
From: Julius Marminge
Date: Mon, 16 Nov 2026 20:18:50 +0000
Subject: [PATCH 12/13] fix(web): page dialogs can be answered in the floating
mini player
A desktop Browser tab shown only in the mini player now shows the same
dialog card, so a held dialog no longer blocks the page there until the
tab is opened in the panel.
Co-Authored-By: Claude Opus 5.5
---
.../preview/ThreadPreviewMiniPlayer.tsx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
index 3e4dba8d879ca..ff1a2ac326a96 100644
--- a/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
+++ b/apps/web/src/components/preview/ThreadPreviewMiniPlayer.tsx
@@ -16,6 +16,7 @@ import { scopedThreadKey } from "@t3tools/client-runtime/environment";
import { useChatCanvas } from "../chat/ChatCanvasContext";
import type { ChatCanvasPreview } from "../chat/chatCanvasLayout";
+import { BrowserDialogCard } from "~/browser/BrowserDialogCard";
import { BrowserSurfaceSlot } from "~/browser/BrowserSurfaceSlot";
import {
findActiveBrowserRecordingRuntimeTabId,
@@ -270,6 +271,7 @@ function BrowserMiniPlayer({ threadRef, tabId, miniPlayer }: Props & { readonly
: null;
const loadFailed = snapshot.navStatus._tag === "LoadFailed" ? snapshot.navStatus : null;
const poppedOut = serverTab ? serverPictureInPicture : Boolean(desktopOverlay?.pictureInPicture);
+ const pageDialog = desktopOverlay?.dialog;
const canPopOut = serverTab
? poppedOut || (pdfUrl === null && supportsServerPictureInPicture())
: true;
@@ -363,6 +365,19 @@ function BrowserMiniPlayer({ threadRef, tabId, miniPlayer }: Props & { readonly
Reconnecting preview…
) : null}
+ {pageDialog ? (
+
+ void previewBridge
+ ?.answerDialog(runtimeTabId, pageDialog.id, accept)
+ .catch(() => undefined)
+ }
+ />
+ ) : null}
>
)
}
From 68200b1a14d863b4687f642ff331a471d878fa36 Mon Sep 17 00:00:00 2001
From: BelKed <66956532+BelKed@users.noreply.github.com>
Date: Thu, 19 Nov 2026 11:03:59 +0100
Subject: [PATCH 13/13] fix(web): long page dialogs keep their buttons in view
---
apps/web/src/browser/BrowserDialogCard.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/web/src/browser/BrowserDialogCard.tsx b/apps/web/src/browser/BrowserDialogCard.tsx
index a6e88d0d7b985..75daa1eab33c6 100644
--- a/apps/web/src/browser/BrowserDialogCard.tsx
+++ b/apps/web/src/browser/BrowserDialogCard.tsx
@@ -25,13 +25,13 @@ export function BrowserDialogCard({
return (
-
{dialog.message}
+
{dialog.message}
{canAnswer ? (
<>
{dialog.type === "prompt" ? (