MultiSelect: enable adding multiple emails with , or space
This commit is contained in:
parent
868a8621e1
commit
868ec214ce
3 changed files with 13 additions and 1 deletions
|
@ -19,6 +19,7 @@ import '@reach/combobox/styles.css';
|
|||
import { matchSorter } from 'match-sorter';
|
||||
import { fire } from '@utils';
|
||||
import { XIcon } from '@heroicons/react/outline';
|
||||
import isHotkey from 'is-hotkey';
|
||||
|
||||
const Context = createContext();
|
||||
|
||||
|
@ -83,7 +84,12 @@ function ComboMultipleDropdownList({
|
|||
};
|
||||
|
||||
const onKeyDown = (event) => {
|
||||
if (event.key === 'Enter') {
|
||||
if (
|
||||
isHotkey('enter', event) ||
|
||||
isHotkey(' ', event) ||
|
||||
isHotkey(',', event) ||
|
||||
isHotkey(';', event)
|
||||
) {
|
||||
if (
|
||||
term &&
|
||||
[...extraOptions, ...options].map(([label]) => label).includes(term)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue