Fix *Tab* key submitting search
This commit is contained in:
parent
97f6b40a6a
commit
e47054a2c5
@ -119,6 +119,12 @@ export default function Search({ options }) {
|
|||||||
};
|
};
|
||||||
}, [selectedProvider, options, query, searchSuggestions]);
|
}, [selectedProvider, options, query, searchSuggestions]);
|
||||||
|
|
||||||
|
const handleSearchKeyDown = (event) => {
|
||||||
|
if (event.key === "Tab") {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const submitCallback = useCallback(
|
const submitCallback = useCallback(
|
||||||
(value) => {
|
(value) => {
|
||||||
const q = encodeURIComponent(value);
|
const q = encodeURIComponent(value);
|
||||||
@ -168,6 +174,7 @@ export default function Search({ options }) {
|
|||||||
// eslint-disable-next-line jsx-a11y/no-autofocus
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
||||||
autoFocus={options.focus}
|
autoFocus={options.focus}
|
||||||
onBlur={(e) => e.preventDefault()}
|
onBlur={(e) => e.preventDefault()}
|
||||||
|
onKeyDown={handleSearchKeyDown}
|
||||||
/>
|
/>
|
||||||
<Listbox
|
<Listbox
|
||||||
as="div"
|
as="div"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user