Skip to content

Adjust   rendering to prevent absurd mutations on Firefox #4520

Closed
ckeditor/ckeditor5-engine
#1748
@scofalik

Description

@scofalik

Steps to reproduce

  1. Open an editor with track changes plugin on Firefox.
  2. Put the caret before a space character.
  3. Turn on track changes mode.
  4. Press space, space, and a non-space character (e.g. "r").

After pressing non-space character, the editor throws. I dug into this issue and here are the mutations generated by the Firefox:

DOM before change (inserting "r"):

 culture can <span>&nbsp; </span>

The caret is after &nbsp;. The <span> is a marker. Expected result is: <span>&nbsp;r </span>.

Following three mutations are generated by Firefox:

image

Where the first two targets is the text node in the span and the third target is of course the text node before the span.

Now what happens here, what FF does?

  1. It correctly changes &nbsp; to &nbsp;r .
  2. But then stupid thing happens - &nbsp; is moved out of the <span> and added to the text node before (this is mutation two and three).

I have no idea why would Firefox do that. It just changes the content. It's not simply changing normal spaces to &nbsp; or something, it's moving a space outside of <span>.

I checked and it seems that Firefox prefers when &nbsp; is before a tag. So, instead of having Foo <span>&nbsp;bar</span> it prefers Foo&nbsp;<span> bar</span>. When I tested with &nbsp;s generated this way, the bug disappeared.

Metadata

Metadata

Assignees

Labels

package:enginetype:bugThis issue reports a buggy (incorrect) behavior.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions