diff --git a/components/lib/multiselect/MultiSelect.js b/components/lib/multiselect/MultiSelect.js index 12cd740a3e..79c461d7f3 100644 --- a/components/lib/multiselect/MultiSelect.js +++ b/components/lib/multiselect/MultiSelect.js @@ -981,11 +981,31 @@ export const MultiSelect = React.memo( ZIndexUtils.clear(overlayRef.current); }); + const onClearIconKeyDown = (event) => { + event.preventDefault(); + event.stopPropagation(); + + switch (event.code) { + case 'Space': + case 'NumpadEnter': + case 'Enter': + if (props.inline) { + break; + } + + updateModel(event, [], []); + break; + } + }; + const createClearIcon = () => { const clearIconProps = mergeProps( { className: cx('clearIcon'), - onClick: (e) => updateModel(e, [], []) + onClick: (e) => updateModel(e, [], []), + tabIndex: props.tabIndex || '0', + 'aria-label': localeOption('clear'), + onKeyDown: (e) => onClearIconKeyDown(e) }, ptm('clearIcon') );