From 6318714aeeff3e5118989de9a45b92eadb214f4c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 14 Jun 2024 22:56:39 -0400 Subject: [PATCH] fix: Escape does not close CMD+K when viewing a document or collection --- app/components/Sharing/Collection/SharePopover.tsx | 3 +++ app/components/Sharing/Document/SharePopover.tsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/components/Sharing/Collection/SharePopover.tsx b/app/components/Sharing/Collection/SharePopover.tsx index 6e0e37aad..a33655f74 100644 --- a/app/components/Sharing/Collection/SharePopover.tsx +++ b/app/components/Sharing/Collection/SharePopover.tsx @@ -59,6 +59,9 @@ function SharePopover({ collection, visible, onRequestClose }: Props) { useKeyDown( "Escape", (ev) => { + if (!visible) { + return; + } ev.preventDefault(); ev.stopImmediatePropagation(); diff --git a/app/components/Sharing/Document/SharePopover.tsx b/app/components/Sharing/Document/SharePopover.tsx index 81877f787..8bef2e122 100644 --- a/app/components/Sharing/Document/SharePopover.tsx +++ b/app/components/Sharing/Document/SharePopover.tsx @@ -67,6 +67,9 @@ function SharePopover({ useKeyDown( "Escape", (ev) => { + if (!visible) { + return; + } ev.preventDefault(); ev.stopImmediatePropagation();