Skip to content

Commit

Permalink
List View: Use 'isMatch' for unselect the shortcut (#61223)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: andrewserong <[email protected]>
  • Loading branch information
3 people committed Apr 30, 2024
1 parent 83737c1 commit 8c90f60
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { BACKSPACE, DELETE, ESCAPE } from '@wordpress/keycodes';
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
import isShallowEqual from '@wordpress/is-shallow-equal';
import { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';

Expand Down Expand Up @@ -183,7 +183,10 @@ function ListViewBlock( {

// If multiple blocks are selected, deselect all blocks when the user
// presses the escape key.
if ( event.keyCode === ESCAPE && selectedClientIds.length > 0 ) {
if (
isMatch( 'core/block-editor/unselect', event ) &&
selectedClientIds.length > 0
) {
event.stopPropagation();
event.preventDefault();
selectBlock( event, undefined );
Expand Down

1 comment on commit 8c90f60

@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 8c90f60.
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/8890192902
📝 Reported issues:

Please sign in to comment.