Skip to content

Commit

Permalink
Stop propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 28, 2024
1 parent edda9db commit 59708ba
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export default function getClickableItemProps< Item >(
role: 'button',
tabIndex: 0,
onClick: ( event: React.MouseEvent ) => {
event.preventDefault();
// Prevents onChangeSelection from triggering.
event.stopPropagation();
onClickItem( item );
},
onKeyDown: ( event: React.KeyboardEvent ) => {
if ( event.key === 'Enter' || event.key === '' ) {
event.preventDefault();
// Prevents onChangeSelection from triggering.
event.stopPropagation();
onClickItem( item );
}
Expand Down

0 comments on commit 59708ba

Please sign in to comment.