diff --git a/docs/reference/faq.md b/docs/reference/faq.md index 8842bad8ab378e..07860e4357d3f8 100644 --- a/docs/reference/faq.md +++ b/docs/reference/faq.md @@ -70,7 +70,7 @@ This is the canonical list of keyboard shortcuts: ### Block shortcuts * Shift+⌘D Duplicate the selected block(s). -* Option+⌘Backspace Remove the selected block(s). +* Ctrl+Option+z Remove the selected block(s). * Option+⌘T Insert a new block before the selected block(s). * Option+⌘Y Insert a new block after the selected block(s). * / Change the block type after adding a new paragraph. diff --git a/edit-post/components/keyboard-shortcut-help-modal/config.js b/edit-post/components/keyboard-shortcut-help-modal/config.js index 0801f45fe37ed9..58239121ecd4f8 100644 --- a/edit-post/components/keyboard-shortcut-help-modal/config.js +++ b/edit-post/components/keyboard-shortcut-help-modal/config.js @@ -93,7 +93,7 @@ const blockShortcuts = { description: __( 'Duplicate the selected block(s).' ), }, { - keyCombination: primaryAlt( 'backspace' ), + keyCombination: access( 'z' ), description: __( 'Remove the selected block(s).' ), }, { diff --git a/edit-post/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap b/edit-post/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap index 29de6e61e6ace7..19552a94b50b72 100644 --- a/edit-post/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +++ b/edit-post/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap @@ -167,11 +167,11 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ Object { "description": "Remove the selected block(s).", "keyCombination": Array [ - "Ctrl", + "Shift", "+", "Alt", "+", - "Backspace", + "Z", ], }, Object { diff --git a/packages/editor/src/components/editor-global-keyboard-shortcuts/index.js b/packages/editor/src/components/editor-global-keyboard-shortcuts/index.js index 09598054d96c7f..cb416cf44ae82d 100644 --- a/packages/editor/src/components/editor-global-keyboard-shortcuts/index.js +++ b/packages/editor/src/components/editor-global-keyboard-shortcuts/index.js @@ -28,8 +28,8 @@ export const shortcuts = { display: displayShortcut.primaryShift( 'd' ), }, removeBlock: { - raw: rawShortcut.primaryAlt( 'backspace' ), - display: displayShortcut.primaryAlt( 'Backspace' ), + raw: rawShortcut.access( 'z' ), + display: displayShortcut.access( 'z' ), }, insertBefore: { raw: rawShortcut.primaryAlt( 't' ), diff --git a/packages/editor/src/components/rich-text/index.js b/packages/editor/src/components/rich-text/index.js index 4b5d90a3ad1dc8..7688af78e4d8b8 100644 --- a/packages/editor/src/components/rich-text/index.js +++ b/packages/editor/src/components/rich-text/index.js @@ -23,7 +23,7 @@ import { getScrollContainer, } from '@wordpress/dom'; import { createBlobURL } from '@wordpress/blob'; -import { BACKSPACE, DELETE, ENTER, LEFT, RIGHT, rawShortcut, isKeyboardEvent } from '@wordpress/keycodes'; +import { BACKSPACE, DELETE, ENTER, LEFT, RIGHT, rawShortcut } from '@wordpress/keycodes'; import { Slot } from '@wordpress/components'; import { withDispatch, withSelect } from '@wordpress/data'; import { rawHandler, children } from '@wordpress/blocks'; @@ -406,12 +406,6 @@ export class RichText extends Component { const { keyCode } = event; const isReverse = keyCode === BACKSPACE; - // User is using the Remove Block shortcut, so allow the event to bubble - // up to the BlockSettingsMenu component - if ( isKeyboardEvent.primaryAlt( event, 'Backspace' ) ) { - return; - } - const { isCollapsed } = getSelection(); // Only process delete if the key press occurs at uncollapsed edge. diff --git a/test/e2e/specs/block-deletion.test.js b/test/e2e/specs/block-deletion.test.js index bb530f9478b69e..2a504f83de4ef9 100644 --- a/test/e2e/specs/block-deletion.test.js +++ b/test/e2e/specs/block-deletion.test.js @@ -6,7 +6,7 @@ import { getEditedPostContent, newPost, pressWithModifier, - META_KEY, + ACCESS_MODIFIER_KEYS, } from '../support/utils'; const addThreeParagraphsToNewPost = async () => { @@ -50,7 +50,7 @@ describe( 'block deletion -', () => { it( 'results in two remaining blocks and positions the caret at the end of the second block', async () => { // Type some text to assert that the shortcut also deletes block content. await page.keyboard.type( 'this is block 2' ); - await pressWithModifier( [ 'Alt', META_KEY ], 'Backspace' ); + await pressWithModifier( ACCESS_MODIFIER_KEYS, 'z' ); expect( await getEditedPostContent() ).toMatchSnapshot(); // Type additional text and assert that caret position is correct by comparing to snapshot.