Skip to content

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

fix(search): close dialog on window blur to prevent stuck overlay

Louis Beaumont9abd10a07b5a
diff --git a/screenpipe-app-tauri/components/rewind/search-command.tsx b/screenpipe-app-tauri/components/rewind/search-command.tsx
index afee54d5d..7c29cc303 100644
--- a/screenpipe-app-tauri/components/rewind/search-command.tsx
+++ b/screenpipe-app-tauri/components/rewind/search-command.tsx
@@ -53,6 +53,17 @@ export function SearchCommand() {
return () => document.removeEventListener("keydown", down, true);
}, [open]);
+ // Close dialog when window loses focus to prevent stuck invisible overlay
+ React.useEffect(() => {
+ const handleBlur = () => {
+ if (open) {
+ setOpen(false);
+ }
+ };
+ window.addEventListener("blur", handleBlur);
+ return () => window.removeEventListener("blur", handleBlur);
+ }, [open]);
+
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === "Enter") {
e.preventDefault();