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

Editor Selection State does not update when mouseup occurs outside of iframe or storybook window

jaffemd opened this issue · comments

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

Bug

What is the current behavior?

When the Editor component is mounted inside of an iframe, such as a story in storybook, the editor does not fire an onChange event to update the selection if the mouse up for the selection occurs outside of the iframe window. This causes the selection state to not update, so any subsequent text deletions or changes will occur at the old cursor position, instead of the area the user just selected.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You

Screen.Recording.2022-03-30.at.10.32.26.AM.mov

What is the expected behavior?

The onChange event should fire to update the editor state regardless of where the mouseup occurs.

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": "0.11.7"
"@storybook/react": "6.4.19"
Chrome: 99.0.4844.84
MacOS: 11.6