diff --git a/src/components/widgets/search/search.jsx b/src/components/widgets/search/search.jsx index 21c933d2..2a05b1b2 100644 --- a/src/components/widgets/search/search.jsx +++ b/src/components/widgets/search/search.jsx @@ -121,8 +121,19 @@ export default function Search({ options }) { const handleSearchKeyDown = (event) => { if (event.key === "Tab") { - // TODO: add actual tab complete event.preventDefault(); + + const list = document.getElementById("comboboxOptions").getElementsByTagName("li"); + if (list.length === 0) { + return; + } + + for (let i = 0; i < list.length; i += 1) { + const item = list.item(i); + if (item.getAttribute("data-headlessui-state") === "active") { + setQuery(item.textContent); + } + } } }; @@ -233,7 +244,10 @@ export default function Search({ options }) { {searchSuggestions[1]?.length > 0 && ( - +
{searchSuggestions[1].map((suggestion) => (