Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichText: ignore selection changes during composition #16960

merged 1 commit into from Aug 14, 2019


Copy link

commented Aug 8, 2019


This PR fixes input composition after #16875. We're checking selection during keyup now as well, but we shouldn't do that during input composition as the browser will otherwise fail to compose.

This is done already for the selectionchange event:

if ( event && event.nativeEvent.isComposing ) {
// Also don't update any selection.
document.removeEventListener( 'selectionchange', this.onSelectionChange );

Unfortunately I'm not able to write any e2e tests. Puppeteer won't compose characters when given the right sequence of keys, and I'm not succeeding at emulating it. I cannot recreate the internal state and UI that the browser has, and it's this state that gets destroyed if we record any input or selection during composition.

Screenshot 2019-08-08 at 11 51 01

The line under this backtick means that the browser is composing. Any ideas are welcome here.

How has this been tested?

This depends a bit on your keyboard layout. For a US/QWERTY layout:

  • Press Alt+`.
  • Press a.

The result should be à.

(Puppeteer ignores Alt+` here.)


Types of changes


  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
@ellatrix ellatrix force-pushed the fix/rich-text-composition branch from 40c6753 to 2587972 Aug 14, 2019
Copy link

left a comment


@ellatrix ellatrix force-pushed the fix/rich-text-composition branch from edf5956 to 2587972 Aug 14, 2019

This comment has been minimized.

Copy link
Member Author

commented Aug 14, 2019

Thanks for testing!

@ellatrix ellatrix merged commit b99ae56 into master Aug 14, 2019
7 checks passed
7 checks passed
Filter opened
Filter opened
Filter opened
Filter opened
Milestone It
Milestone It
Travis CI - Pull Request Build Passed
@ellatrix ellatrix deleted the fix/rich-text-composition branch Aug 14, 2019
dd32 pushed a commit to dd32/gutenberg that referenced this pull request Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.