MultiSelect: select values on blur
This commit is contained in:
parent
3313ea5885
commit
bf462380e6
1 changed files with 12 additions and 0 deletions
|
@ -100,6 +100,17 @@ function ComboMultipleDropdownList({
|
|||
}
|
||||
};
|
||||
|
||||
const onBlur = (event) => {
|
||||
if (
|
||||
acceptNewValues &&
|
||||
term &&
|
||||
[...extraOptions, ...options].map(([label]) => label).includes(term)
|
||||
) {
|
||||
event.preventDefault();
|
||||
return onSelect(term);
|
||||
}
|
||||
};
|
||||
|
||||
const saveSelection = (fn) => {
|
||||
setSelections((selections) => {
|
||||
selections = fn(selections);
|
||||
|
@ -162,6 +173,7 @@ function ComboMultipleDropdownList({
|
|||
value={term}
|
||||
onChange={handleChange}
|
||||
onKeyDown={onKeyDown}
|
||||
onBlur={onBlur}
|
||||
autocomplete={false}
|
||||
/>
|
||||
</ComboboxTokenLabel>
|
||||
|
|
Loading…
Reference in a new issue