Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(workbench): dismiss share popover via inert iframe, not modal

cyh6ac82fd426a1
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index 71f442454..7c012427b 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -130,6 +130,11 @@ export const ChatPage: React.FC = () => {
// next toggle (the page row already exists, so `existed` alone won't re-prompt).
const showPagePromptRetryRef = useRef<Set<string>>(new Set());
const [showPageUrl, setShowPageUrl] = useState<string | null>(null);
+ // True while the share popover is open. The popover floats over the Show Page
+ // iframe; making the iframe inert lets an outside tap there reach the parent
+ // document so the (non-modal) popover dismisses, without modal-blocking the
+ // sibling header buttons (which would then need two taps).
+ const [shareOpen, setShareOpen] = useState(false);
useEffect(() => {
// ChatPage is reused across :sessionId — clear all show-page state so the
// next chat starts in chat view with a live (not stuck-busy) toggle.
@@ -1333,6 +1338,7 @@ export const ChatPage: React.FC = () => {
showPageBusy={showPageBusy}
onToggleShowPage={toggleShowPage}
onShowPageVisibilityChange={handleShowPagePayload}
+ onShareOpenChange={setShareOpen}
/>
{showPageMode && showPageUrl && (
@@ -1354,7 +1360,7 @@ export const ChatPage: React.FC = () => {
src={showPageUrl}
sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals allow-downloads"
allow="clipboard-write"
- className="min-h-0 w-full flex-1 border-0 bg-background"
+ className={clsx('min-h-0 w-full flex-1 border-0 bg-background', shareOpen && 'pointer-events-none')}
/>
)}
@@ -1519,9 +1525,10 @@ interface ChatHeaderBarProps {
showPageBusy: boolean;
onToggleShowPage: () => void;
onShowPageVisibilityChange?: (payload: ShowPageLinkInfo) => void;
+ onShareOpenChange?: (open: boolean) => void;
}
-const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, defaultAgentName, onPatch, onBack, working, showPageMode, showPageBusy, onToggleShowPage, onShowPageVisibilityChange }) => {
+const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, defaultAgentName, onPatch, onBack, working, showPageMode, showPageBusy, onToggleShowPage, onShowPageVisibilityChange, onShareOpenChange }) => {
const { t } = useTranslation();
const defaultAgent = defaultAgentName ? agents.find((agent) => agent.name === defaultAgentName) : null;
// Backend locks once a NATIVE conversation exists — a native can only be
@@ -1630,7 +1637,11 @@ const ChatHeaderBar: React.FC<ChatHeaderBarProps> = ({ session, agents, defaultA
</span>
</Button>
{showPageMode && (
- <ShowPageShareControl sessionId={session.id} onPayloadChange={onShowPageVisibilityChange} />
+ <ShowPageShareControl
+ sessionId={session.id}
+ onPayloadChange={onShowPageVisibilityChange}
+ onOpenChange={onShareOpenChange}
+ />
)}
</div>
</div>
diff --git a/ui/src/components/workbench/ShowPageShareControl.tsx b/ui/src/components/workbench/ShowPageShareControl.tsx
index 3f5c5b640..0f291bb78 100644
--- a/ui/src/components/workbench/ShowPageShareControl.tsx
+++ b/ui/src/components/workbench/ShowPageShareControl.tsx
@@ -24,7 +24,11 @@ export const ShowPageShareControl: React.FC<{
// Lets the chat view re-point the iframe at the route that now serves the
// page when visibility flips (private↔public swap the serving route).
onPayloadChange?: (payload: ShowPageLinkInfo) => void;
-}> = ({ sessionId, onPayloadChange }) => {
+ // The popover floats over the Show Page iframe; the chat view makes the iframe
+ // inert while it is open so an outside tap there falls through to the parent
+ // document and Radix can dismiss (a tap inside an iframe never reaches us).
+ onOpenChange?: (open: boolean) => void;
+}> = ({ sessionId, onPayloadChange, onOpenChange }) => {
const { t } = useTranslation();
const api = useApi();
const [open, setOpen] = useState(false);
@@ -67,6 +71,7 @@ export const ShowPageShareControl: React.FC<{
const handleOpenChange = (next: boolean) => {
setOpen(next);
+ onOpenChange?.(next);
if (next) refresh();
};
@@ -101,13 +106,8 @@ export const ShowPageShareControl: React.FC<{
}
};
- // modal: the popover floats over the Show Page iframe; without it an outside
- // tap lands inside the iframe (a separate browsing context) and never reaches
- // the parent document, so Radix can't detect it to dismiss. modal adds a
- // viewport guard above the iframe that captures the tap (mobile, where the
- // iframe fills most of the screen, hit this; desktop has parent chrome around).
return (
- <Popover open={open} onOpenChange={handleOpenChange} modal>
+ <Popover open={open} onOpenChange={handleOpenChange}>
<PopoverTrigger asChild>
<Button
type="button"