Only prevent tab if suggestion dropdown is open.
This commit is contained in:
parent
e47054a2c5
commit
fb9818e1fc
@ -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 }) {
|
||||
</Listbox>
|
||||
|
||||
{searchSuggestions[1]?.length > 0 && (
|
||||
<Combobox.Options className="mt-1 rounded-md bg-theme-50 dark:bg-theme-800 border border-theme-300 dark:border-theme-200/30 cursor-pointer shadow-lg">
|
||||
<Combobox.Options
|
||||
className="mt-1 rounded-md bg-theme-50 dark:bg-theme-800 border border-theme-300 dark:border-theme-200/30 cursor-pointer shadow-lg"
|
||||
id="comboboxOptions"
|
||||
>
|
||||
<div className="p-1 bg-white/50 dark:bg-white/10 text-theme-900/90 dark:text-white/90 text-xs">
|
||||
<Combobox.Option key={query} value={query} />
|
||||
{searchSuggestions[1].map((suggestion) => (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user