facebookarchive / draft-js

A React framework for building text editors.

Home Page:https://draftjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`anchorKey` and `focusKey` are identical when selecting multiple blocks

tdnelson2 opened this issue · comments

Do you want to request a feature or report a bug?

Yes, report a bug

What is the current behavior?

When selecting multiple blocks of text, editorState.getSelection().getAnchorKey() and editorState.getSelection().getGetFocusKey() are identical if the selection was made from bottom to top. editorState.getSelection().getAnchorKey() and editorState.getSelection().getFocusKey() are as expected if the selection is made from top to bottom.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: https://jsfiddle.net/gmertk/e61z7nfa/.

The bug can be reproduced by selecting multiple blocks (paragraphs) of text from bottom to top.

What is the expected behavior?

When multiple blocks of text is selected from bottom to top, editorState.getSelection().getAnchorKey() and editorState.getSelection().getFocusKey() should correspond the the correct block keys. They should not be identical.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?

Draft.js version ^0.11.7
Chrome Version 99.0.4844.51 (Official Build) (x86_64)
macOS Version 11.6.2 (20G314)
It is unclear if this worked in a previous version of Draft.js.

I was unable to reproduce the error in JSFiddle: https://jsfiddle.net/qa7yL1kb/22/
It must be a problem with my setup. I will close this issue