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 Nov 28, 2024
1 parent db263fb commit 6a989b4
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

1 comment on commit 6a989b4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 6a989b4.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12073121012
📝 Reported issues:

Please sign in to comment.