From 8dd77f3bbd4c39339a775d44d5434ca85edb0fe9 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Wed, 3 Jul 2024 22:15:59 +0300 Subject: [PATCH] fix: remove focus on ESC (#7535) Now when pressing ESC, command bar will lose focus. ![image](https://github.com/Unleash/unleash/assets/964450/9aea3b2b-bf06-4910-96be-0a67472945af) --- frontend/src/component/commandBar/CommandBar.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/component/commandBar/CommandBar.tsx b/frontend/src/component/commandBar/CommandBar.tsx index 53e824430d..6e40dbbbf4 100644 --- a/frontend/src/component/commandBar/CommandBar.tsx +++ b/frontend/src/component/commandBar/CommandBar.tsx @@ -195,6 +195,9 @@ export const CommandBar = () => { ); useKeyboardShortcut({ key: 'Escape' }, () => { setShowSuggestions(false); + if (searchContainerRef.current?.contains(document.activeElement)) { + searchInputRef.current?.blur(); + } }); const placeholder = `Command bar (${hotkey})`;