YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(browser): hide native webview behind modals (#4348)
Harsh Kumare3cbb57f61c0
diff --git a/apps/screenpipe-app-tauri/components/browser-sidebar.tsx b/apps/screenpipe-app-tauri/components/browser-sidebar.tsxindex ee7ac9cc5..6a2d05fa1 100644--- a/apps/screenpipe-app-tauri/components/browser-sidebar.tsx+++ b/apps/screenpipe-app-tauri/components/browser-sidebar.tsx@@ -191,6 +191,8 @@ export function BrowserSidebar({const boundsRafRef = useRef<number | null>(null);/** True while the cookie-consent card is up — pushBounds must not re-show the native webview. */const sessionAccessActiveRef = useRef(false);+ /** True while any Radix dialog/modal is open — pushBounds must not re-show the native webview. */+ const dialogActiveRef = useRef(false);const dragStateRef = useRef<{ startX: number; startWidth: number } | null>(null,);@@ -260,8 +262,9 @@ export function BrowserSidebar({const el = placeholderRef.current;if (!el) return;// Native child webviews sit above HTML — never position/show while the- // session-access card is visible (ResizeObserver races with hide()).- if (sessionAccessActiveRef.current) {+ // session-access card or any dialog/modal is visible (the native webview+ // would cover the HTML overlay otherwise).+ if (sessionAccessActiveRef.current || dialogActiveRef.current) {await commands.ownedBrowserHide().catch(() => {});return;}@@ -316,6 +319,37 @@ export function BrowserSidebar({};}, []);+ // ---------------------------------------------------------------------------+ // Dialog/modal detection — hide the native webview when any Radix dialog is+ // open, otherwise it covers the HTML overlay.+ // ---------------------------------------------------------------------------++ useEffect(() => {+ // Only target full-page modal dialogs (with backdrop overlay), not small+ // popovers or dropdown menus. Our DialogOverlay and AlertDialogOverlay+ // components add data-modal-overlay; popovers/dropdowns don't have one.+ const hasModalOverlay = () =>+ document.querySelectorAll("[data-modal-overlay]").length > 0;++ const sync = () => {+ const open = hasModalOverlay();+ if (open && !dialogActiveRef.current) {+ dialogActiveRef.current = true;+ commands.ownedBrowserHide().catch(() => {});+ } else if (!open && dialogActiveRef.current) {+ dialogActiveRef.current = false;+ schedulePushBounds();+ }+ };++ const observer = new MutationObserver(sync);+ observer.observe(document.body, { childList: true, subtree: true });+ // Check initial state in case a dialog is already open.+ sync();++ return () => observer.disconnect();+ }, [schedulePushBounds]);+// ---------------------------------------------------------------------------// Viewport resize tracking — drives both the JS clamp and re-pushing bounds// ---------------------------------------------------------------------------diff --git a/apps/screenpipe-app-tauri/components/ui/alert-dialog.tsx b/apps/screenpipe-app-tauri/components/ui/alert-dialog.tsxindex 4e1ec1559..dd5f0d48f 100644--- a/apps/screenpipe-app-tauri/components/ui/alert-dialog.tsx+++ b/apps/screenpipe-app-tauri/components/ui/alert-dialog.tsx@@ -16,6 +16,7 @@ const AlertDialogOverlay = React.forwardRef<React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>>(({ className, ...props }, ref) => (<AlertDialogPrimitive.Overlay+ data-modal-overlay=""className={cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",classNamediff --git a/apps/screenpipe-app-tauri/components/ui/dialog.tsx b/apps/screenpipe-app-tauri/components/ui/dialog.tsxindex dbcbde6d1..a3f3071cc 100644--- a/apps/screenpipe-app-tauri/components/ui/dialog.tsx+++ b/apps/screenpipe-app-tauri/components/ui/dialog.tsx@@ -25,6 +25,7 @@ const DialogOverlay = React.forwardRef<>(({ className, ...props }, ref) => (<DialogPrimitive.Overlayref={ref}+ data-modal-overlay=""className={cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",className