Skip to content

Commit

Permalink
fix: #7377, MultiSelect: Cannot access the close Icon and clear the i…
Browse files Browse the repository at this point in the history
…nput using keyboard in Filled mode (#7378)

* fix: #7377, MultiSelect: Cannot access the close Icon and clear the input using keyboard in Filled mode

* fix: #7377, MultiSelect: Cannot access the close Icon and clear the input using keyboard in Filled mode

---------

Co-authored-by: ANTONA09 <[email protected]>
  • Loading branch information
akshayaqburst and ANTONA09 authored Nov 1, 2024
1 parent 6c1913f commit aefd6a8
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion components/lib/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
);
Expand Down

0 comments on commit aefd6a8

Please sign in to comment.