Skip to content

Commit

Permalink
Merge pull request #6235 from qburst/master
Browse files Browse the repository at this point in the history
fix: primefaces #6234, TreeSelect: (accessiblility) cannot access and clear the selected input using using keyboard
  • Loading branch information
nitrogenous authored Apr 29, 2024
2 parents d40ad85 + 4e7a63f commit 0d95f72
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion components/lib/treeselect/TreeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ export const TreeSelect = React.memo(
}
};

const onClearIconKeyDown = (event) => {
if (event.key === 'Enter' || event.code === 'Space') {
clear(event);
event.preventDefault();
}
};

const onNodeSelect = (node) => {
props.onNodeSelect && props.onNodeSelect(node);
isSingleSelectionMode && hide();
Expand Down Expand Up @@ -628,7 +635,10 @@ export const TreeSelect = React.memo(
const clearIconProps = mergeProps(
{
className: cx('clearIcon'),
onPointerUp: clear
onPointerUp: clear,
tabIndex: props.tabIndex || '0',
onKeyDown: onClearIconKeyDown,
'aria-label': localeOption('clear')
},
ptm('clearIcon')
);
Expand Down

0 comments on commit 0d95f72

Please sign in to comment.