From 8a3dfcb9d0860eb8f8112a84dcf32ae522f77069 Mon Sep 17 00:00:00 2001
From: dan <dan.abramov@gmail.com>
Date: Fri, 20 Dec 2024 18:00:30 +0000
Subject: Don't add unused keydown listeners (#7218)

---
 src/view/com/util/forms/NativeDropdown.web.tsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/view/com/util/forms/NativeDropdown.web.tsx')

diff --git a/src/view/com/util/forms/NativeDropdown.web.tsx b/src/view/com/util/forms/NativeDropdown.web.tsx
index c1a0b8096..b3ec319e3 100644
--- a/src/view/com/util/forms/NativeDropdown.web.tsx
+++ b/src/view/com/util/forms/NativeDropdown.web.tsx
@@ -70,6 +70,10 @@ export function NativeDropdown({
   const menuRef = React.useRef<HTMLDivElement>(null)
 
   React.useEffect(() => {
+    if (!open) {
+      return
+    }
+
     function clickHandler(e: MouseEvent) {
       const t = e.target
 
-- 
cgit 1.4.1

