From f01016c64f35818d0cf7f0257fcfa7909068a3ec Mon Sep 17 00:00:00 2001 From: Matthew Meszaros Date: Thu, 1 Oct 2026 22:27:45 -0700 Subject: [PATCH 1/2] feat: close every dashboard dropdown on a tap inside a same-origin iframe such as the unibox email body by listening on the frame's own document in useClickOutside, re-attaching when the frame reloads, since a tap on a phone never moves focus into the frame --- web/src/hooks/useClickOutside.test.tsx | 34 +++++++++++++++++++++++++- web/src/hooks/useClickOutside.ts | 22 ++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/web/src/hooks/useClickOutside.test.tsx b/web/src/hooks/useClickOutside.test.tsx index e2ede53f2..6c5d5f53e 100644 --- a/web/src/hooks/useClickOutside.test.tsx +++ b/web/src/hooks/useClickOutside.test.tsx @@ -1,5 +1,5 @@ // useClickOutside is how every dropdown closes: a press outside it, Escape (the -// innermost one only), or focus moving into an iframe. +// innermost one only), or focus moving into or a tap landing in an iframe. import React from "react"; import { createPortal } from "react-dom"; @@ -140,4 +140,36 @@ describe("useClickOutside", () => { await settle(); expect(isOpen("A")).toBe(false); }); + + // A tap on a phone moves no focus, so only the frame's own document hears it. + it("closes on a tap inside a same-origin frame that never takes focus", () => { + render( + <> + +