Skip to content

Commit

Permalink
DataViews: Avoid double click handler on primary fields (#67393)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: gigitux <[email protected]>
  • Loading branch information
3 people authored and michalczaplinski committed Dec 5, 2024
1 parent 07bcce8 commit 081db5e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ export default function getClickableItemProps< Item >(
className: `${ className } ${ className }--clickable`,
role: 'button',
tabIndex: 0,
onClick: () => onClickItem( item ),
onClick: ( event: React.MouseEvent ) => {
// Prevents onChangeSelection from triggering.
event.stopPropagation();
onClickItem( item );
},
onKeyDown: ( event: React.KeyboardEvent ) => {
if ( event.key === 'Enter' || event.key === '' ) {
// Prevents onChangeSelection from triggering.
event.stopPropagation();
onClickItem( item );
}
},
Expand Down

0 comments on commit 081db5e

Please sign in to comment.