From 0b3875c2cf4ba45a7589a895205f061cbfed7076 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 6 Aug 2023 16:54:13 +0800 Subject: [PATCH] Only focus when menu item is clicked --- src/components/status.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 1e7e83a0..844fa0df 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -848,10 +848,12 @@ function Status({ state={isContextMenuOpen ? 'open' : undefined} anchorPoint={contextMenuAnchorPoint} direction="right" - onClose={() => { + onClose={(e) => { setIsContextMenuOpen(false); // statusRef.current?.focus?.(); - statusRef.current?.closest('[tabindex]')?.focus?.(); + if (e?.reason === 'click') { + statusRef.current?.closest('[tabindex]')?.focus?.(); + } }} portal={{ target: document.body,