diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 2370774e3..493b6ae8e 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -1569,10 +1569,6 @@ class TextEditorComponent { } didTextInput (event) { - // Workaround for Chromium not preventing composition events when - // preventDefault is called on the keydown event that precipitated them. - if (this.lastKeydown && this.lastKeydown.defaultPrevented) return - if (!this.isInputEnabled()) return event.stopPropagation() @@ -1665,7 +1661,16 @@ class TextEditorComponent { didCompositionUpdate (event) { // Workaround for Chromium not preventing composition events when // preventDefault is called on the keydown event that precipitated them. - if (this.lastKeydown && this.lastKeydown.defaultPrevented) return + if (this.lastKeydown && this.lastKeydown.defaultPrevented) { + this.getHiddenInput().disabled = true + process.nextTick(() => { + // Disabling the hidden input makes it lose focus as well, so we have to + // re-enable and re-focus it. + this.getHiddenInput().disabled = false + this.getHiddenInput().focus() + }) + return + } if (this.getChromeVersion() === 56) { process.nextTick(() => {