From f97f17f3bfba801a729c3688b0df07d025e37768 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 20 Dec 2024 12:01:33 +0530 Subject: [PATCH 1/9] KeyboardShortcuts: Update delete shortcut to use Shift + Delete and add Backspace alias --- .../src/components/keyboard-shortcuts/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index 9b83844646922..7db88f3d8be44 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -29,9 +29,14 @@ function KeyboardShortcutsRegister() { category: 'block', description: __( 'Remove the selected block(s).' ), keyCombination: { - modifier: 'access', - character: 'z', + modifier: 'shift', + character: 'del', }, + aliases: [ + { + character: 'backspace', + }, + ], } ); registerShortcut( { From 8526e3d9ea7348f49cd75ac8247fb0f8e46a022e Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 20 Dec 2024 13:26:49 +0530 Subject: [PATCH 2/9] KeyboardShortcuts: Add Shift modifier for Backspace alias --- packages/block-editor/src/components/keyboard-shortcuts/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index 7db88f3d8be44..89b28e42c0123 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -34,6 +34,7 @@ function KeyboardShortcutsRegister() { }, aliases: [ { + modifier: 'shift', character: 'backspace', }, ], From 27325fdf5fcf4a711e88bb9d29414fd392954029 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 20 Dec 2024 13:50:02 +0530 Subject: [PATCH 3/9] KeyboardShortcuts: Update delete shortcut character from 'del' to 'delete' --- .../block-editor/src/components/keyboard-shortcuts/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index 89b28e42c0123..8e66a8fb65c2b 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -30,7 +30,7 @@ function KeyboardShortcutsRegister() { description: __( 'Remove the selected block(s).' ), keyCombination: { modifier: 'shift', - character: 'del', + character: 'delete', }, aliases: [ { From e7975b3f2f80935e14a3b405bffa8ff6c823893f Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 20 Dec 2024 15:45:24 +0530 Subject: [PATCH 4/9] KeyboardShortcuts: Update delete shortcut to use Shift + Delete --- .../src/page-utils/keycodes.ts | 6 ++++++ test/e2e/specs/editor/blocks/navigation.spec.js | 10 +++++----- test/e2e/specs/editor/various/block-deletion.spec.js | 2 +- test/e2e/specs/editor/various/block-locking.spec.js | 2 +- test/e2e/specs/editor/various/list-view.spec.js | 12 ++++++------ test/e2e/specs/site-editor/template-part.spec.js | 2 +- test/e2e/specs/widgets/editing-widgets.spec.js | 2 +- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts b/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts index 3a848ac8fb766..f2ae2d186c7a7 100644 --- a/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts +++ b/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts @@ -23,6 +23,11 @@ export const COMMAND = 'meta'; */ export const SHIFT = 'shift'; +/** + * Keycode for DELETE key. + */ +export const DELETE = 'delete'; + /** * Object that contains functions that return the available modifier * depending on platform. @@ -44,5 +49,6 @@ export const modifiers: Record< ctrlShift: () => [ CTRL, SHIFT ], shift: () => [ SHIFT ], shiftAlt: () => [ SHIFT, ALT ], + delete: () => [ DELETE ], undefined: () => [], }; diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index 83e95a08c0f6a..7daab2f6ecc12 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -276,7 +276,7 @@ test.describe( 'Navigation block', () => { await pageUtils.pressKeys( 'ArrowDown' ); // remove the child link - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); const submenuBlock2 = editor.canvas.getByRole( 'document', { name: 'Block: Submenu', @@ -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( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); // 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 @@ -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( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); 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( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); await navigation.checkLabelFocus( 'Cat' ); // Deleting with no more siblings should focus the navigation block again - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); await expect( navBlock ).toBeFocused(); // Wait until the nav block inserter is visible before we continue. await expect( navBlockInserter ).toBeVisible(); diff --git a/test/e2e/specs/editor/various/block-deletion.spec.js b/test/e2e/specs/editor/various/block-deletion.spec.js index 9346412c46bcb..fb7d898d1e5de 100644 --- a/test/e2e/specs/editor/various/block-deletion.spec.js +++ b/test/e2e/specs/editor/various/block-deletion.spec.js @@ -134,7 +134,7 @@ test.describe( 'Block deletion', () => { ).toBeFocused(); // Remove the current paragraph via dedicated keyboard shortcut. - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); // Ensure the last block was removed. await expect.poll( editor.getBlocks ).toMatchObject( [ diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index a8895d282fb95..5b6e3e6946b56 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -133,7 +133,7 @@ test.describe( 'Block Locking', () => { ).toBeVisible(); await paragraph.click(); - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); await expect.poll( editor.getBlocks ).toMatchObject( [ { diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index 531faa8bea049..52febba89ac39 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -809,8 +809,8 @@ test.describe( 'List View', () => { // Delete remaining blocks. // Keyboard shortcut should also work. - await pageUtils.pressKeys( 'access+z' ); - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'shift+delete' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -842,7 +842,7 @@ test.describe( 'List View', () => { { name: 'core/heading', selected: false }, ] ); - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -865,7 +865,7 @@ test.describe( 'List View', () => { .getByRole( 'gridcell', { name: 'File' } ) .getByRole( 'link' ) .focus(); - for ( const keys of [ 'Delete', 'Backspace', 'access+z' ] ) { + for ( const keys of [ 'Delete', 'Backspace', 'shift+delete' ] ) { await pageUtils.pressKeys( keys ); await expect .poll( @@ -1133,7 +1133,7 @@ test.describe( 'List View', () => { optionsForFileMenu, 'Pressing Space should also open the menu dropdown' ).toBeVisible(); - await pageUtils.pressKeys( 'access+z' ); // Keyboard shortcut for Delete. + await pageUtils.pressKeys( 'shift+delete' ); // Keyboard shortcut for Delete. await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -1153,7 +1153,7 @@ test.describe( 'List View', () => { optionsForFileMenu.getByRole( 'menuitem', { name: 'Delete' } ), 'The delete menu item should be hidden for locked blocks' ).toBeHidden(); - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index d88273574bc4b..abab6cf221027 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -375,7 +375,7 @@ test.describe( 'Template Part', () => { await editor.selectBlocks( siteTitle ); // Remove the default site title block. - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); // Insert a group block with a Site Title block inside. await editor.insertBlock( { diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index 019e07fe87daa..a287330a26a90 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -573,7 +573,7 @@ test.describe( 'Widgets screen', () => { .getByRole( 'document', { name: 'Block: Paragraph' } ) .filter( { hasText: 'Second Paragraph' } ) .focus(); - await pageUtils.pressKeys( 'access+z' ); + await pageUtils.pressKeys( 'shift+delete' ); await widgetsScreen.saveWidgets(); await expect.poll( widgetsScreen.getWidgetAreaBlocks ).toMatchObject( { From 019e6b044d1c5f714867b85fc9e5da3f60281425 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Mon, 23 Dec 2024 14:28:27 +0530 Subject: [PATCH 5/9] KeyboardShortcuts: Change delete shortcut to platformAlt + Backspace --- .../src/components/keyboard-shortcuts/index.js | 10 ++-------- .../src/page-utils/keycodes.ts | 5 +++-- packages/keycodes/src/index.js | 3 ++- test/e2e/specs/editor/blocks/navigation.spec.js | 10 +++++----- .../specs/editor/various/block-deletion.spec.js | 2 +- .../specs/editor/various/block-locking.spec.js | 2 +- test/e2e/specs/editor/various/list-view.spec.js | 16 ++++++++++------ test/e2e/specs/site-editor/template-part.spec.js | 2 +- test/e2e/specs/widgets/editing-widgets.spec.js | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index 8e66a8fb65c2b..a967e6f673b54 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -29,15 +29,9 @@ function KeyboardShortcutsRegister() { category: 'block', description: __( 'Remove the selected block(s).' ), keyCombination: { - modifier: 'shift', - character: 'delete', + modifier: 'platformAlt', + character: 'backspace', }, - aliases: [ - { - modifier: 'shift', - character: 'backspace', - }, - ], } ); registerShortcut( { diff --git a/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts b/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts index f2ae2d186c7a7..a5cca37f02dac 100644 --- a/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts +++ b/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts @@ -26,7 +26,7 @@ export const SHIFT = 'shift'; /** * Keycode for DELETE key. */ -export const DELETE = 'delete'; +export const BACKSPACE = 'backspace'; /** * Object that contains functions that return the available modifier @@ -44,11 +44,12 @@ export const modifiers: Record< secondary: ( _isApple ) => _isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ], access: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ), + platformAlt: ( _isApple ) => ( _isApple() ? [ CTRL ] : [ ALT ] ), ctrl: () => [ CTRL ], alt: () => [ ALT ], ctrlShift: () => [ CTRL, SHIFT ], shift: () => [ SHIFT ], shiftAlt: () => [ SHIFT, ALT ], - delete: () => [ DELETE ], + backspace: () => [ BACKSPACE ], undefined: () => [], }; diff --git a/packages/keycodes/src/index.js b/packages/keycodes/src/index.js index b6df5e3f4a214..85d526921b824 100644 --- a/packages/keycodes/src/index.js +++ b/packages/keycodes/src/index.js @@ -21,7 +21,7 @@ import { isAppleOS } from './platform'; /** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */ -/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */ +/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'platformAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */ /** * An object of handler functions for each of the possible modifier @@ -188,6 +188,7 @@ export const modifiers = { secondary: ( _isApple ) => _isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ], access: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ), + platformAlt: ( _isApple ) => ( _isApple() ? [ CTRL ] : [ ALT ] ), ctrl: () => [ CTRL ], alt: () => [ ALT ], ctrlShift: () => [ CTRL, SHIFT ], diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index 7daab2f6ecc12..ae58869196943 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -276,7 +276,7 @@ test.describe( 'Navigation block', () => { await pageUtils.pressKeys( 'ArrowDown' ); // remove the child link - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); const submenuBlock2 = editor.canvas.getByRole( 'document', { name: 'Block: Submenu', @@ -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( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); // 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 @@ -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( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); 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( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await navigation.checkLabelFocus( 'Cat' ); // Deleting with no more siblings should focus the navigation block again - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await expect( navBlock ).toBeFocused(); // Wait until the nav block inserter is visible before we continue. await expect( navBlockInserter ).toBeVisible(); diff --git a/test/e2e/specs/editor/various/block-deletion.spec.js b/test/e2e/specs/editor/various/block-deletion.spec.js index fb7d898d1e5de..50d591e244693 100644 --- a/test/e2e/specs/editor/various/block-deletion.spec.js +++ b/test/e2e/specs/editor/various/block-deletion.spec.js @@ -134,7 +134,7 @@ test.describe( 'Block deletion', () => { ).toBeFocused(); // Remove the current paragraph via dedicated keyboard shortcut. - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); // Ensure the last block was removed. await expect.poll( editor.getBlocks ).toMatchObject( [ diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index 5b6e3e6946b56..882dcabc2669a 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -133,7 +133,7 @@ test.describe( 'Block Locking', () => { ).toBeVisible(); await paragraph.click(); - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await expect.poll( editor.getBlocks ).toMatchObject( [ { diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index 52febba89ac39..e28fc7a5c7c63 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -809,8 +809,8 @@ test.describe( 'List View', () => { // Delete remaining blocks. // Keyboard shortcut should also work. - await pageUtils.pressKeys( 'shift+delete' ); - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -842,7 +842,7 @@ test.describe( 'List View', () => { { name: 'core/heading', selected: false }, ] ); - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -865,7 +865,11 @@ test.describe( 'List View', () => { .getByRole( 'gridcell', { name: 'File' } ) .getByRole( 'link' ) .focus(); - for ( const keys of [ 'Delete', 'Backspace', 'shift+delete' ] ) { + for ( const keys of [ + 'Delete', + 'Backspace', + 'platformAlt+backspace', + ] ) { await pageUtils.pressKeys( keys ); await expect .poll( @@ -1133,7 +1137,7 @@ test.describe( 'List View', () => { optionsForFileMenu, 'Pressing Space should also open the menu dropdown' ).toBeVisible(); - await pageUtils.pressKeys( 'shift+delete' ); // Keyboard shortcut for Delete. + await pageUtils.pressKeys( 'platformAlt+backspace' ); // Keyboard shortcut for Delete. await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -1153,7 +1157,7 @@ test.describe( 'List View', () => { optionsForFileMenu.getByRole( 'menuitem', { name: 'Delete' } ), 'The delete menu item should be hidden for locked blocks' ).toBeHidden(); - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index abab6cf221027..6c721f6d04550 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -375,7 +375,7 @@ test.describe( 'Template Part', () => { await editor.selectBlocks( siteTitle ); // Remove the default site title block. - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); // Insert a group block with a Site Title block inside. await editor.insertBlock( { diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index a287330a26a90..8ebec07248a86 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -573,7 +573,7 @@ test.describe( 'Widgets screen', () => { .getByRole( 'document', { name: 'Block: Paragraph' } ) .filter( { hasText: 'Second Paragraph' } ) .focus(); - await pageUtils.pressKeys( 'shift+delete' ); + await pageUtils.pressKeys( 'platformAlt+backspace' ); await widgetsScreen.saveWidgets(); await expect.poll( widgetsScreen.getWidgetAreaBlocks ).toMatchObject( { From 33542de08810eaf55d6fffce470db2e82878be11 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Mon, 23 Dec 2024 15:48:32 +0530 Subject: [PATCH 6/9] KeyboardShortcuts: Update delete shortcut to use primaryShift + Delete --- .../src/components/keyboard-shortcuts/index.js | 8 +++++++- .../src/page-utils/keycodes.ts | 7 ------- packages/keycodes/src/index.js | 3 +-- test/e2e/specs/editor/blocks/navigation.spec.js | 10 +++++----- .../specs/editor/various/block-deletion.spec.js | 2 +- .../specs/editor/various/block-locking.spec.js | 2 +- test/e2e/specs/editor/various/list-view.spec.js | 16 ++++++---------- test/e2e/specs/site-editor/template-part.spec.js | 2 +- test/e2e/specs/widgets/editing-widgets.spec.js | 2 +- 9 files changed, 23 insertions(+), 29 deletions(-) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index a967e6f673b54..dfe2020617f00 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -29,9 +29,15 @@ function KeyboardShortcutsRegister() { category: 'block', description: __( 'Remove the selected block(s).' ), keyCombination: { - modifier: 'platformAlt', + modifier: 'primaryShift', character: 'backspace', }, + aliases: [ + { + modifier: 'primaryShift', + character: 'delete', + }, + ], } ); registerShortcut( { diff --git a/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts b/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts index a5cca37f02dac..3a848ac8fb766 100644 --- a/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts +++ b/packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts @@ -23,11 +23,6 @@ export const COMMAND = 'meta'; */ export const SHIFT = 'shift'; -/** - * Keycode for DELETE key. - */ -export const BACKSPACE = 'backspace'; - /** * Object that contains functions that return the available modifier * depending on platform. @@ -44,12 +39,10 @@ export const modifiers: Record< secondary: ( _isApple ) => _isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ], access: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ), - platformAlt: ( _isApple ) => ( _isApple() ? [ CTRL ] : [ ALT ] ), ctrl: () => [ CTRL ], alt: () => [ ALT ], ctrlShift: () => [ CTRL, SHIFT ], shift: () => [ SHIFT ], shiftAlt: () => [ SHIFT, ALT ], - backspace: () => [ BACKSPACE ], undefined: () => [], }; diff --git a/packages/keycodes/src/index.js b/packages/keycodes/src/index.js index 85d526921b824..b6df5e3f4a214 100644 --- a/packages/keycodes/src/index.js +++ b/packages/keycodes/src/index.js @@ -21,7 +21,7 @@ import { isAppleOS } from './platform'; /** @typedef {typeof ALT | CTRL | COMMAND | SHIFT } WPModifierPart */ -/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'platformAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */ +/** @typedef {'primary' | 'primaryShift' | 'primaryAlt' | 'secondary' | 'access' | 'ctrl' | 'alt' | 'ctrlShift' | 'shift' | 'shiftAlt' | 'undefined'} WPKeycodeModifier */ /** * An object of handler functions for each of the possible modifier @@ -188,7 +188,6 @@ export const modifiers = { secondary: ( _isApple ) => _isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ], access: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ), - platformAlt: ( _isApple ) => ( _isApple() ? [ CTRL ] : [ ALT ] ), ctrl: () => [ CTRL ], alt: () => [ ALT ], ctrlShift: () => [ CTRL, SHIFT ], diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index ae58869196943..68dc35f555f31 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -276,7 +276,7 @@ test.describe( 'Navigation block', () => { await pageUtils.pressKeys( 'ArrowDown' ); // remove the child link - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); const submenuBlock2 = editor.canvas.getByRole( 'document', { name: 'Block: Submenu', @@ -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( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); // 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 @@ -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( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); 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( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await navigation.checkLabelFocus( 'Cat' ); // Deleting with no more siblings should focus the navigation block again - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await expect( navBlock ).toBeFocused(); // Wait until the nav block inserter is visible before we continue. await expect( navBlockInserter ).toBeVisible(); diff --git a/test/e2e/specs/editor/various/block-deletion.spec.js b/test/e2e/specs/editor/various/block-deletion.spec.js index 50d591e244693..062d799280b13 100644 --- a/test/e2e/specs/editor/various/block-deletion.spec.js +++ b/test/e2e/specs/editor/various/block-deletion.spec.js @@ -134,7 +134,7 @@ test.describe( 'Block deletion', () => { ).toBeFocused(); // Remove the current paragraph via dedicated keyboard shortcut. - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); // Ensure the last block was removed. await expect.poll( editor.getBlocks ).toMatchObject( [ diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index 882dcabc2669a..e0a359446944f 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -133,7 +133,7 @@ test.describe( 'Block Locking', () => { ).toBeVisible(); await paragraph.click(); - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await expect.poll( editor.getBlocks ).toMatchObject( [ { diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index e28fc7a5c7c63..ac10c5a49a7f4 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -809,8 +809,8 @@ test.describe( 'List View', () => { // Delete remaining blocks. // Keyboard shortcut should also work. - await pageUtils.pressKeys( 'platformAlt+backspace' ); - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -842,7 +842,7 @@ test.describe( 'List View', () => { { name: 'core/heading', selected: false }, ] ); - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -865,11 +865,7 @@ test.describe( 'List View', () => { .getByRole( 'gridcell', { name: 'File' } ) .getByRole( 'link' ) .focus(); - for ( const keys of [ - 'Delete', - 'Backspace', - 'platformAlt+backspace', - ] ) { + for ( const keys of [ 'Delete', 'Backspace', 'primaryShift+Delete' ] ) { await pageUtils.pressKeys( keys ); await expect .poll( @@ -1137,7 +1133,7 @@ test.describe( 'List View', () => { optionsForFileMenu, 'Pressing Space should also open the menu dropdown' ).toBeVisible(); - await pageUtils.pressKeys( 'platformAlt+backspace' ); // Keyboard shortcut for Delete. + await pageUtils.pressKeys( 'primaryShift+Delete' ); // Keyboard shortcut for Delete. await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -1157,7 +1153,7 @@ test.describe( 'List View', () => { optionsForFileMenu.getByRole( 'menuitem', { name: 'Delete' } ), 'The delete menu item should be hidden for locked blocks' ).toBeHidden(); - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index 6c721f6d04550..dc65cba64b791 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -375,7 +375,7 @@ test.describe( 'Template Part', () => { await editor.selectBlocks( siteTitle ); // Remove the default site title block. - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); // Insert a group block with a Site Title block inside. await editor.insertBlock( { diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index 8ebec07248a86..edd365365776a 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -573,7 +573,7 @@ test.describe( 'Widgets screen', () => { .getByRole( 'document', { name: 'Block: Paragraph' } ) .filter( { hasText: 'Second Paragraph' } ) .focus(); - await pageUtils.pressKeys( 'platformAlt+backspace' ); + await pageUtils.pressKeys( 'primaryShift+Delete' ); await widgetsScreen.saveWidgets(); await expect.poll( widgetsScreen.getWidgetAreaBlocks ).toMatchObject( { From 429c7bd88ff339b558e13205fe66d2560fd5eb1a Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Mon, 23 Dec 2024 16:11:37 +0530 Subject: [PATCH 7/9] KeyboardShortcuts: Update Block Locking spec to use the proper key shortcut --- test/e2e/specs/editor/various/block-locking.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index e0a359446944f..cf81fede4c31d 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -133,7 +133,7 @@ test.describe( 'Block Locking', () => { ).toBeVisible(); await paragraph.click(); - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await expect.poll( editor.getBlocks ).toMatchObject( [ { From 1cdc6ead73738cd0d906baf0254400d4f69f7631 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Tue, 24 Dec 2024 14:21:01 +0530 Subject: [PATCH 8/9] KeyboardShortcuts: Change delete shortcut to primaryShift + Backspace --- .../src/components/keyboard-shortcuts/index.js | 6 ------ .../rich-text/event-listeners/delete.js | 7 ++++++- test/e2e/specs/editor/blocks/navigation.spec.js | 10 +++++----- .../specs/editor/various/block-deletion.spec.js | 2 +- test/e2e/specs/editor/various/list-view.spec.js | 16 ++++++++++------ test/e2e/specs/site-editor/template-part.spec.js | 2 +- test/e2e/specs/widgets/editing-widgets.spec.js | 2 +- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index dfe2020617f00..4d368e6c1d0ab 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -32,12 +32,6 @@ function KeyboardShortcutsRegister() { modifier: 'primaryShift', character: 'backspace', }, - aliases: [ - { - modifier: 'primaryShift', - character: 'delete', - }, - ], } ); registerShortcut( { diff --git a/packages/block-editor/src/components/rich-text/event-listeners/delete.js b/packages/block-editor/src/components/rich-text/event-listeners/delete.js index ae3fd733bb94e..9300e1b88cf3a 100644 --- a/packages/block-editor/src/components/rich-text/event-listeners/delete.js +++ b/packages/block-editor/src/components/rich-text/event-listeners/delete.js @@ -6,7 +6,7 @@ import { isCollapsed, isEmpty } from '@wordpress/rich-text'; export default ( props ) => ( element ) => { function onKeyDown( event ) { - const { keyCode } = event; + const { keyCode, ctrlKey, metaKey, shiftKey } = event; if ( event.defaultPrevented ) { return; @@ -30,6 +30,11 @@ export default ( props ) => ( element ) => { return; } + // Exclude (command|ctrl)+shift+backspace as they are shortcuts for deleting blocks. + if ( ( ctrlKey && shiftKey ) || ( metaKey && shiftKey ) ) { + return; + } + if ( onMerge ) { onMerge( ! isReverse ); } diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index 68dc35f555f31..c04ef78811e06 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -276,7 +276,7 @@ test.describe( 'Navigation block', () => { await pageUtils.pressKeys( 'ArrowDown' ); // remove the child link - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); const submenuBlock2 = editor.canvas.getByRole( 'document', { name: 'Block: Submenu', @@ -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+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); // 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 @@ -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+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); 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+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await navigation.checkLabelFocus( 'Cat' ); // Deleting with no more siblings should focus the navigation block again - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await expect( navBlock ).toBeFocused(); // Wait until the nav block inserter is visible before we continue. await expect( navBlockInserter ).toBeVisible(); diff --git a/test/e2e/specs/editor/various/block-deletion.spec.js b/test/e2e/specs/editor/various/block-deletion.spec.js index 062d799280b13..f90923c6dc382 100644 --- a/test/e2e/specs/editor/various/block-deletion.spec.js +++ b/test/e2e/specs/editor/various/block-deletion.spec.js @@ -134,7 +134,7 @@ test.describe( 'Block deletion', () => { ).toBeFocused(); // Remove the current paragraph via dedicated keyboard shortcut. - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); // Ensure the last block was removed. await expect.poll( editor.getBlocks ).toMatchObject( [ diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index ac10c5a49a7f4..7319fa3e3dbff 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -809,8 +809,8 @@ test.describe( 'List View', () => { // Delete remaining blocks. // Keyboard shortcut should also work. - await pageUtils.pressKeys( 'primaryShift+Delete' ); - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -842,7 +842,7 @@ test.describe( 'List View', () => { { name: 'core/heading', selected: false }, ] ); - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -865,7 +865,11 @@ test.describe( 'List View', () => { .getByRole( 'gridcell', { name: 'File' } ) .getByRole( 'link' ) .focus(); - for ( const keys of [ 'Delete', 'Backspace', 'primaryShift+Delete' ] ) { + for ( const keys of [ + 'Delete', + 'Backspace', + 'primaryShift+Backspace', + ] ) { await pageUtils.pressKeys( keys ); await expect .poll( @@ -1133,7 +1137,7 @@ test.describe( 'List View', () => { optionsForFileMenu, 'Pressing Space should also open the menu dropdown' ).toBeVisible(); - await pageUtils.pressKeys( 'primaryShift+Delete' ); // Keyboard shortcut for Delete. + await pageUtils.pressKeys( 'primaryShift+Backspace' ); // Keyboard shortcut for Delete. await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -1153,7 +1157,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+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index dc65cba64b791..d3feeb866619a 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -375,7 +375,7 @@ test.describe( 'Template Part', () => { await editor.selectBlocks( siteTitle ); // Remove the default site title block. - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); // Insert a group block with a Site Title block inside. await editor.insertBlock( { diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index edd365365776a..648b04d3e202b 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -573,7 +573,7 @@ test.describe( 'Widgets screen', () => { .getByRole( 'document', { name: 'Block: Paragraph' } ) .filter( { hasText: 'Second Paragraph' } ) .focus(); - await pageUtils.pressKeys( 'primaryShift+Delete' ); + await pageUtils.pressKeys( 'primaryShift+Backspace' ); await widgetsScreen.saveWidgets(); await expect.poll( widgetsScreen.getWidgetAreaBlocks ).toMatchObject( { From 2544805c3f2521e40f5bd329729b3288081bbca3 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Tue, 24 Dec 2024 15:00:54 +0530 Subject: [PATCH 9/9] KeyboardShortcuts: Update delete shortcut to use `shift + Backspace` --- .../src/components/keyboard-shortcuts/index.js | 2 +- .../rich-text/event-listeners/delete.js | 6 +++--- test/e2e/specs/editor/blocks/navigation.spec.js | 10 +++++----- .../specs/editor/various/block-deletion.spec.js | 2 +- .../specs/editor/various/block-locking.spec.js | 2 +- test/e2e/specs/editor/various/list-view.spec.js | 16 ++++++---------- test/e2e/specs/site-editor/template-part.spec.js | 2 +- test/e2e/specs/widgets/editing-widgets.spec.js | 2 +- 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/packages/block-editor/src/components/keyboard-shortcuts/index.js b/packages/block-editor/src/components/keyboard-shortcuts/index.js index 4d368e6c1d0ab..fcc2cea404375 100644 --- a/packages/block-editor/src/components/keyboard-shortcuts/index.js +++ b/packages/block-editor/src/components/keyboard-shortcuts/index.js @@ -29,7 +29,7 @@ function KeyboardShortcutsRegister() { category: 'block', description: __( 'Remove the selected block(s).' ), keyCombination: { - modifier: 'primaryShift', + modifier: 'shift', character: 'backspace', }, } ); diff --git a/packages/block-editor/src/components/rich-text/event-listeners/delete.js b/packages/block-editor/src/components/rich-text/event-listeners/delete.js index 9300e1b88cf3a..8373ca3c9f72a 100644 --- a/packages/block-editor/src/components/rich-text/event-listeners/delete.js +++ b/packages/block-editor/src/components/rich-text/event-listeners/delete.js @@ -6,7 +6,7 @@ import { isCollapsed, isEmpty } from '@wordpress/rich-text'; export default ( props ) => ( element ) => { function onKeyDown( event ) { - const { keyCode, ctrlKey, metaKey, shiftKey } = event; + const { keyCode, shiftKey } = event; if ( event.defaultPrevented ) { return; @@ -30,8 +30,8 @@ export default ( props ) => ( element ) => { return; } - // Exclude (command|ctrl)+shift+backspace as they are shortcuts for deleting blocks. - if ( ( ctrlKey && shiftKey ) || ( metaKey && shiftKey ) ) { + // Exclude shift+backspace as they are shortcuts for deleting blocks. + if ( shiftKey ) { return; } diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index c04ef78811e06..769e30c99dab3 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -276,7 +276,7 @@ test.describe( 'Navigation block', () => { await pageUtils.pressKeys( 'ArrowDown' ); // remove the child link - await pageUtils.pressKeys( 'primaryShift+Backspace' ); + await pageUtils.pressKeys( 'shift+Backspace' ); const submenuBlock2 = editor.canvas.getByRole( 'document', { name: 'Block: Submenu', @@ -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( 'shift+Backspace' ); // 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 @@ -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( 'shift+Backspace' ); 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( 'shift+Backspace' ); await navigation.checkLabelFocus( 'Cat' ); // Deleting with no more siblings should focus the navigation block again - await pageUtils.pressKeys( 'primaryShift+Backspace' ); + await pageUtils.pressKeys( 'shift+Backspace' ); await expect( navBlock ).toBeFocused(); // Wait until the nav block inserter is visible before we continue. await expect( navBlockInserter ).toBeVisible(); diff --git a/test/e2e/specs/editor/various/block-deletion.spec.js b/test/e2e/specs/editor/various/block-deletion.spec.js index f90923c6dc382..5e4ead97c986f 100644 --- a/test/e2e/specs/editor/various/block-deletion.spec.js +++ b/test/e2e/specs/editor/various/block-deletion.spec.js @@ -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( 'shift+Backspace' ); // Ensure the last block was removed. await expect.poll( editor.getBlocks ).toMatchObject( [ diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index cf81fede4c31d..b31fc9e2cd140 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -133,7 +133,7 @@ test.describe( 'Block Locking', () => { ).toBeVisible(); await paragraph.click(); - await pageUtils.pressKeys( 'primaryShift+Backspace' ); + await pageUtils.pressKeys( 'shift+Backspace' ); await expect.poll( editor.getBlocks ).toMatchObject( [ { diff --git a/test/e2e/specs/editor/various/list-view.spec.js b/test/e2e/specs/editor/various/list-view.spec.js index 7319fa3e3dbff..6bf1689a40049 100644 --- a/test/e2e/specs/editor/various/list-view.spec.js +++ b/test/e2e/specs/editor/various/list-view.spec.js @@ -809,8 +809,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( 'shift+Backspace' ); + await pageUtils.pressKeys( 'shift+Backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -842,7 +842,7 @@ test.describe( 'List View', () => { { name: 'core/heading', selected: false }, ] ); - await pageUtils.pressKeys( 'primaryShift+Backspace' ); + await pageUtils.pressKeys( 'shift+Backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -865,11 +865,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', 'shift+Backspace' ] ) { await pageUtils.pressKeys( keys ); await expect .poll( @@ -1137,7 +1133,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( 'shift+Backspace' ); // Keyboard shortcut for Delete. await expect .poll( listViewUtils.getBlocksWithA11yAttributes, @@ -1157,7 +1153,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( 'shift+Backspace' ); await expect .poll( listViewUtils.getBlocksWithA11yAttributes, diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index d3feeb866619a..9d5c0ca05b0d9 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -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( 'shift+Backspace' ); // Insert a group block with a Site Title block inside. await editor.insertBlock( { diff --git a/test/e2e/specs/widgets/editing-widgets.spec.js b/test/e2e/specs/widgets/editing-widgets.spec.js index 648b04d3e202b..f4d160f8a36db 100644 --- a/test/e2e/specs/widgets/editing-widgets.spec.js +++ b/test/e2e/specs/widgets/editing-widgets.spec.js @@ -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( 'shift+Backspace' ); await widgetsScreen.saveWidgets(); await expect.poll( widgetsScreen.getWidgetAreaBlocks ).toMatchObject( {