kopia lustrzana https://github.com/wagtail/wagtail
Ensure block preview is hidden when the user clears out the search input
rodzic
14d3341ffd
commit
c70719bfa6
|
@ -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);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue