Hi, I’ve stumbled across some editor selection behaviour on Chrome that’s different to Firefox and Safari. It has to do with CSS :before
pseudo-elements. I’ve created a demo to showcase the issue here.
In the sandbox, I have a simple editor schema which is made up from 3 nodes:
doc
: Generic top level node. Contains at least one block
node.
block
: Node which contains a paragraph within a div, with text
nodes inside. The first block
node in the document also has a “>” :before
element on the div.
text
: Generic text node.
In Firefox/Safari, clicking a block
node to the right of the text inside it moves the selection to the end of the node, regardless of if it has the :before
pseudo-element:
In Chrome however, doing the same thing will move the selection to the start of the block if it has the :before
pseudo-element. Otherwise, the behaviour matches Firefox/Safari:
I’ve managed to work around it somewhat by setting display: inline
on both the paragraph and the :before
pseudo-element instead of using a flexbox. Ideally though, I would like to keep using flexbox as this workaround has its own issues.
Is this something that should be fixed within ProseMirror? If not, do you have any suggestions for a more suitable workaround such that I can still use a flexbox? Thanks!