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 3a848ac8fb7667..f2ae2d186c7a72 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 83e95a08c0f6a2..7daab2f6ecc120 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 9346412c46bcb2..fb7d898d1e5dee 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 a8895d282fb956..5b6e3e6946b565 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 531faa8bea049d..52febba89ac398 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 d88273574bc4b0..abab6cf2210274 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 019e07fe87daac..a287330a26a90c 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( {