ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.94k stars 3.25k forks source link

Selection is not lost when clicking a non-editable block in the editor (and then outside) #1769

Open zhouzi opened 6 years ago

zhouzi commented 6 years ago

Clicking an element with contentEditable={false} in the editor is ignored and the selection remains as if nothing happened. The selection says that the focused node is still the one that was focused before clicking the non-editable element. More importantly, clicking outside of the editor after that doesn't clear the selection which still says that it's focused.

Steps to reproduce

  1. Create a document with a node that renders a contentEditable={false} component
  2. Click in the editor so value.selection.isFocused becomes true
  3. Click on the contentEditable={false}, value.selection.isFocused remains true
  4. Click somewhere outside of the editor, value.selection.isFocused is still true

Reproduction

The bug was not present in an older version of Slate: reproduction.

SamyPesse commented 6 years ago

@ianstormtaylor Any idea where this regression may come from ?

@Zhouzi Which versions are being used in both reproductions ? (it may help us find the regression)

ianstormtaylor commented 6 years ago

Nope, not off the top of my head. Would need someone to investigate.

nucleartux commented 6 years ago

@ianstormtaylor Any progress? I have same problem with input inside void block (as in example https://github.com/ianstormtaylor/slate/blob/master/examples/embeds/video.js), when I click on input value.blocks still contains previous focused element.