From 0d7fccc91c0cf3e60bc1d0f8942bf12c9833e172 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Tue, 31 Oct 2017 19:01:13 -0700 Subject: [PATCH] Avoid executing hotkeys while composing (#1357) --- packages/slate-react/src/plugins/before.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/slate-react/src/plugins/before.js b/packages/slate-react/src/plugins/before.js index 272fbe1cf..ffc37a171 100644 --- a/packages/slate-react/src/plugins/before.js +++ b/packages/slate-react/src/plugins/before.js @@ -371,11 +371,11 @@ function BeforePlugin() { function onKeyDown(event, change, editor) { if (editor.props.readOnly) return true - // When composing, these characters commit the composition but also move the - // selection before we're able to handle it, so prevent their default, - // selection-moving behavior. - if (isComposing && HOTKEYS.COMPOSING(event)) { - event.preventDefault() + // When composing, we need to prevent all hotkeys from executing while + // typing. However, certain characters also move the selection before + // we're able to handle it, so prevent their default behavior. + if (isComposing) { + if (HOTKEYS.COMPOSING(event)) event.preventDefault() return true }