Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Selection breaks when Chinese composition ends without changes in IE11 #2093

Closed
robbertbrak opened this issue May 28, 2019 · 2 comments
Closed

Comments

@robbertbrak
Copy link
Contributor

To reproduce:

  • Use the latest version of Draft (i.e., one that includes 634bd29)
  • In IE11, open the rich text example
  • Switch to Chinese (Simplified, PRC), and use the IME "Microsoft Pinyin New Experience Input Style". This one comes standard with Windows 7.
  • Type ni and then press backspace twice.
  • Type ni again.

Result: the cursor stays on the first (blank) line, whereas the letters ni and the Chinese completions appear on the next line. This is incorrect: there shouldn't be a blank line

  • Type 1 and press enter.

Result: the editor now contains a blank line (with the cursor), followed by a line with the character , followed by a line with the character n. This is incorrect: the editor should only contain and nothing else.

  • Type wo1 and press enter.

Result: the editor now contains a line with n, followed by a line with the character . This is incorrect: the character has somehow disappeared and the n suddenly moved to the top of the editor.

The screencast below shows more clearly what happens:

screencast 2019-05-28 14-01-19

I believe that the editorstate breaks immediately after the step "Type ni and then press backspace twice", which is the first time a composition is resolved.

This might be related to #2080, but it's not the same. The fix that I proposed for that issue does not solve this one.

@robbertbrak
Copy link
Contributor Author

When I change acceptSelection on line https://github.com/facebook/draft-js/blob/943f6dce5188724a11bb392645f5873fe5dcf1a6/src/component/handlers/composition/DraftEditorCompositionHandler.js#L228 to forceSelection, the issue goes away.

@fabiomcosta: Again, I'd be interested to hear what your thoughts are. Is there any particular reason why you would not want to force the selection after resolving a composition?

robbertbrak added a commit to robbertbrak/draft-js that referenced this issue May 28, 2019
@fabiomcosta
Copy link
Contributor

fabiomcosta commented May 28, 2019 via email

vilemj-Viclick pushed a commit to kontent-ai/draft-js that referenced this issue Jul 16, 2020
Summary:
Fixes facebookarchive#2093.
Pull Request resolved: facebookarchive#2094

Reviewed By: claudiopro

Differential Revision: D21770987

Pulled By: mrkev

fbshipit-source-id: f198a89ce2eae69328daa5ce917085ce0d726dba
alicayan008 pushed a commit to alicayan008/draft-js that referenced this issue Jul 4, 2023
Summary:
Fixes facebookarchive/draft-js#2093.
Pull Request resolved: facebookarchive/draft-js#2094

Reviewed By: claudiopro

Differential Revision: D21770987

Pulled By: mrkev

fbshipit-source-id: f198a89ce2eae69328daa5ce917085ce0d726dba
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants