From 178325e1cc07a612e7cd3b94cce0f956cfe3ab74 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 13 Aug 2018 15:15:57 +0800 Subject: [PATCH] Use `isKeyboardEvent` to catch key combination + improve comment --- packages/editor/src/components/rich-text/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/rich-text/index.js b/packages/editor/src/components/rich-text/index.js index dda8813fa227d..91e743c9a4b62 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 } from '@wordpress/keycodes'; +import { BACKSPACE, DELETE, ENTER, LEFT, RIGHT, rawShortcut, isKeyboardEvent } from '@wordpress/keycodes'; import { Slot } from '@wordpress/components'; import { withSelect } from '@wordpress/data'; import { rawHandler, children } from '@wordpress/blocks'; @@ -397,11 +397,12 @@ export class RichText extends Component { return; } - const { keyCode, altKey, metaKey } = event; + const { keyCode } = event; const isReverse = keyCode === BACKSPACE; // User is using the Remove Block shortcut, so allow the event to bubble - if ( altKey && metaKey && isReverse ) { + // up to the BlockSettingsMenu component + if ( isKeyboardEvent.primaryAlt( event, 'Backspace' ) ) { return; }