Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function KeyboardShortcutsRegister() {
category: 'block',
description: __( 'Remove the selected block(s).' ),
keyCombination: {
modifier: 'primaryShift',
character: 'backspace',
modifier: 'access',
character: 'z',
},
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { isCollapsed, isEmpty } from '@wordpress/rich-text';

export default ( props ) => ( element ) => {
function onKeyDown( event ) {
const { keyCode, shiftKey, ctrlKey, metaKey } = event;
const { keyCode } = event;

if ( event.defaultPrevented ) {
return;
Expand All @@ -30,11 +30,6 @@ export default ( props ) => ( element ) => {
return;
}

// Exclude (command|ctrl)+shift+backspace as they are shortcuts for deleting blocks.
if ( shiftKey && ( ctrlKey || metaKey ) ) {
return;
}

if ( onMerge ) {
onMerge( ! isReverse );
}
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/specs/editor/blocks/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ test.describe( 'Navigation block', () => {
await pageUtils.pressKeys( 'ArrowDown' );

// remove the child link
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );

const submenuBlock2 = editor.canvas.getByRole( 'document', {
name: 'Block: Submenu',
Expand Down Expand Up @@ -494,7 +494,7 @@ test.describe( 'Navigation block', () => {
await pageUtils.pressKeys( 'ArrowDown', { times: 4 } );
await navigation.checkLabelFocus( 'wordpress.org' );
// Delete the nav link
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
// Focus moved to sibling
await navigation.checkLabelFocus( 'Dog' );
// Add a link back so we can delete the first submenu link and see if focus returns to the parent submenu item
Expand All @@ -507,15 +507,15 @@ test.describe( 'Navigation block', () => {
await pageUtils.pressKeys( 'ArrowUp', { times: 2 } );
await navigation.checkLabelFocus( 'Dog' );
// Delete the nav link
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await pageUtils.pressKeys( 'ArrowDown' );
// Focus moved to parent submenu item
await navigation.checkLabelFocus( 'example.com' );
// Deleting this should move focus to the sibling item
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await navigation.checkLabelFocus( 'Cat' );
// Deleting with no more siblings should focus the navigation block again
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await expect( navBlock ).toBeFocused();
// Wait until the nav block inserter is visible before we continue.
await expect( navBlockInserter ).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/block-deletion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test.describe( 'Block deletion', () => {
).toBeFocused();

// Remove the current paragraph via dedicated keyboard shortcut.
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );

// Ensure the last block was removed.
await expect.poll( editor.getBlocks ).toMatchObject( [
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/editor/various/block-locking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test.describe( 'Block Locking', () => {
).toBeVisible();

await paragraph.click();
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );

await expect.poll( editor.getBlocks ).toMatchObject( [
{
Expand Down
16 changes: 6 additions & 10 deletions test/e2e/specs/editor/various/list-view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,8 @@ test.describe( 'List View', () => {

// Delete remaining blocks.
// Keyboard shortcut should also work.
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await pageUtils.pressKeys( 'access+z' );
await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
Expand Down Expand Up @@ -1095,7 +1095,7 @@ test.describe( 'List View', () => {
{ name: 'core/heading', selected: false },
] );

await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
Expand All @@ -1118,11 +1118,7 @@ test.describe( 'List View', () => {
.getByRole( 'gridcell', { name: 'File' } )
.getByRole( 'link' )
.focus();
for ( const keys of [
'Delete',
'Backspace',
'primaryShift+Backspace',
] ) {
for ( const keys of [ 'Delete', 'Backspace', 'access+z' ] ) {
await pageUtils.pressKeys( keys );
await expect
.poll(
Expand Down Expand Up @@ -1283,7 +1279,7 @@ test.describe( 'List View', () => {
optionsForFileMenu,
'Pressing Space should also open the menu dropdown'
).toBeVisible();
await pageUtils.pressKeys( 'primaryShift+Backspace' ); // Keyboard shortcut for Delete.
await pageUtils.pressKeys( 'access+z' ); // Keyboard shortcut for Delete.
await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
Expand All @@ -1303,7 +1299,7 @@ test.describe( 'List View', () => {
optionsForFileMenu.getByRole( 'menuitem', { name: 'Delete' } ),
'The delete menu item should be hidden for locked blocks'
).toBeHidden();
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await expect
.poll(
listViewUtils.getBlocksWithA11yAttributes,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/site-editor/template-part.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ test.describe( 'Template Part', () => {
await editor.selectBlocks( siteTitle );

// Remove the default site title block.
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );

// Insert a group block with a Site Title block inside.
await editor.insertBlock( {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/widgets/editing-widgets.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ test.describe( 'Widgets screen', () => {
.getByRole( 'document', { name: 'Block: Paragraph' } )
.filter( { hasText: 'Second Paragraph' } )
.focus();
await pageUtils.pressKeys( 'primaryShift+Backspace' );
await pageUtils.pressKeys( 'access+z' );
await widgetsScreen.saveWidgets();

await expect.poll( widgetsScreen.getWidgetAreaBlocks ).toMatchObject( {
Expand Down
Loading