From fb9818e1fcc628468a806af9f18c16a3393765ac Mon Sep 17 00:00:00 2001 From: Flo2410 Date: Thu, 8 Feb 2024 22:17:25 +0000 Subject: [PATCH] Only prevent tab if suggestion dropdown is open. --- src/components/widgets/search/search.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/widgets/search/search.jsx b/src/components/widgets/search/search.jsx index dbc45a25..a1306243 100644 --- a/src/components/widgets/search/search.jsx +++ b/src/components/widgets/search/search.jsx @@ -120,7 +120,10 @@ export default function Search({ options }) { }, [selectedProvider, options, query, searchSuggestions]); const handleSearchKeyDown = (event) => { - if (event.key === "Tab") { + if ( + event.key === "Tab" && + document.getElementById("comboboxOptions")?.getAttribute("data-headlessui-state") === "open" + ) { event.preventDefault(); } }; @@ -233,7 +236,10 @@ export default function Search({ options }) { {searchSuggestions[1]?.length > 0 && ( - +
{searchSuggestions[1].map((suggestion) => (