Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): retain content ownership of dialog exit lifetime
Xubin Ren3ff76cd808ec
diff --git a/webui/src/components/ui/dialog.tsx b/webui/src/components/ui/dialog.tsxindex 98fd1557c..c093791e1 100644--- a/webui/src/components/ui/dialog.tsx+++ b/webui/src/components/ui/dialog.tsx@@ -36,13 +36,17 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;// positioning wrapper; otherwise the wrapper unmounts before the exit finishes.// Auto margins center/bottom-align surfaces when they fit, but collapse to zero// when they overflow so the beginning of a tall dialog remains scrollable.+// The overlay stays mounted for the content's presence lifetime, so its own+// fade cannot remove the content before its exit cleanup/handoff completes.const DialogPositionedContent = React.forwardRef<React.ElementRef<typeof DialogPrimitive.Content>,React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {positionerStyle?: React.CSSProperties;placement?: "center" | "bottom";+ overlayClassName?: string;}->(({ positionerStyle, placement, ...props }, ref) => (+>(({ positionerStyle, placement, overlayClassName, ...props }, ref) => (+ <DialogOverlay forceMount className={overlayClassName}><div className={cn("fixed inset-0 z-50 flex items-start justify-center overflow-y-auto overscroll-contain", placement !== "bottom" && "p-4")} style={{top: "var(--app-viewport-top, 0px)",height: "var(--app-viewport-height, 100%)",@@ -51,6 +55,7 @@ const DialogPositionedContent = React.forwardRef<}}><DialogPrimitive.Content ref={ref} {...props} /></div>+ </DialogOverlay>));DialogPositionedContent.displayName = "DialogPositionedContent";@@ -99,10 +104,10 @@ const DialogContent = React.forwardRef<}, [ref]);return (<DialogPortal>- <DialogOverlay className={overlayClassName}><DialogPositionedContentpositionerStyle={layout}placement={placement}+ overlayClassName={overlayClassName}ref={contentRef}onOpenAutoFocus={(event) => {if (onOpenAutoFocus) onOpenAutoFocus(event);@@ -131,7 +136,6 @@ const DialogContent = React.forwardRef<</DialogPrimitive.Close>) : null}</DialogPositionedContent>- </DialogOverlay></DialogPortal>);});diff --git a/webui/src/tests/remote-instances.test.tsx b/webui/src/tests/remote-instances.test.tsxindex 75e0fd9be..68f8a3e2d 100644--- a/webui/src/tests/remote-instances.test.tsx+++ b/webui/src/tests/remote-instances.test.tsx@@ -1022,7 +1022,9 @@ describe("remote instance UX", () => {fireEvent.submit(address.closest("form")!);const alert = await screen.findByRole("alert");expect(alert).toHaveTextContent(i18n.t("remote.errors.ssh_agent_refused"));- expect(alert.closest(".overflow-y-auto")).toBeNull();+ // Errors stay outside the form's field scroller. The outer dialog frame+ // may itself scroll when a mobile keyboard leaves less room than the form.+ expect(address.closest("form")!.querySelector(".overflow-y-auto")).not.toContainElement(alert);expect(address).toHaveValue("[email protected]");fireEvent.click(screen.getByRole("button", { name: "Connection options" }));expect(screen.getByRole("spinbutton", { name: "SSH port" })).toHaveValue(2222);