Skip to content

Commit

Permalink
Fix primefaces#3885: Chips separator works on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jan 2, 2023
1 parent 320b627 commit 2b16f52
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions components/lib/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@ export const Chips = React.memo(
return;
}

switch (event.which) {
//backspace
case 8:
switch (event.code) {
case 'Backspace':
if (inputRef.current.value.length === 0 && values.length > 0) {
removeItem(event, values.length - 1);
}

break;

//enter
case 13:
case 'Enter':
if (inputValue && inputValue.trim().length && (!props.max || props.max > values.length)) {
addItem(event, inputValue, true);
}
Expand All @@ -106,7 +104,7 @@ export const Chips = React.memo(

if (isMaxedOut()) {
event.preventDefault();
} else if (props.separator === ',' && event.which === 188) {
} else if (props.separator === ',' && event.code === 'Comma') {
addItem(event, inputValue, true);
}

Expand Down

0 comments on commit 2b16f52

Please sign in to comment.