Skip to content

Commit

Permalink
List View: Respect default shortcuts in modals (#62479)
Browse files Browse the repository at this point in the history
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: andrewserong <[email protected]>
Co-authored-by: mcsf <[email protected]>
Co-authored-by: colorful-tones <[email protected]>
  • Loading branch information
6 people authored Jun 12, 2024
1 parent b8fd20a commit 24aeb31
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ function ListViewBlock( {
return;
}

// Do not handle events if it comes from modals;
// retain the default behavior for these keys.
if ( event.target.closest( '[role=dialog]' ) ) {
return;
}

const isDeleteKey = [ BACKSPACE, DELETE ].includes( event.keyCode );

// If multiple blocks are selected, deselect all blocks when the user
Expand All @@ -196,12 +202,6 @@ function ListViewBlock( {
isDeleteKey ||
isMatch( 'core/block-editor/remove', event )
) {
// Do not handle single-key block deletion shortcuts when events come from modals;
// retain the default behavior for these keys.
if ( isDeleteKey && event.target.closest( '[role=dialog]' ) ) {
return;
}

const {
blocksToUpdate: blocksToDelete,
firstBlockClientId,
Expand Down

1 comment on commit 24aeb31

@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 24aeb31.
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/9475693125
📝 Reported issues:

Please sign in to comment.