Ensure block preview is hidden when the user clears out the search input

pull/12838/head
Sage Abdullah 2025-01-31 15:41:57 +00:00
rodzic 14d3341ffd
commit c70719bfa6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -139,6 +139,9 @@ export default function ComboBox<ComboBoxOption extends ComboBoxItem>({
}, },
onInputValueChange: (changes) => { onInputValueChange: (changes) => {
// Hide any preview when the user types or clears the search input.
setPreviewedIndex(-1);
const { inputValue: val } = changes; const { inputValue: val } = changes;
if (!val) { if (!val) {
setInputItems(flatItems); setInputItems(flatItems);
@ -153,8 +156,6 @@ export default function ComboBox<ComboBoxOption extends ComboBoxItem>({
setInputItems(filtered); setInputItems(filtered);
// Always reset the first item to highlighted on filtering, to speed up selection. // Always reset the first item to highlighted on filtering, to speed up selection.
setHighlightedIndex(0); setHighlightedIndex(0);
// Hide any preview when the user starts typing.
setPreviewedIndex(-1);
}, },
}); });