Understanding cursor movement in contenteditable

145 views
Skip to first unread message

Justin Hummel

unread,
Jun 25, 2024, 8:26:55 PMJun 25
to Chromium-dev
Hello all. We are working on developing a WYSIWYG editor using Chromium. However, we are struggling to understand some of the strange cursor movement problems we are running into. 

One problem, is we want to make parts of the editable surface not editable and skip over them. For example:

<p>
<span>Some text here</span><span class='not-editable' contenteditable='false'><span>A</span></span><span class='not-editable' contenteditable='false'><span>B</span></span><span class='not-editable' contenteditable='false'><span>C</span></span><span>Some trailing text</span>
</p>

When I move from left to right I noticed that in between A and B the cursor will move into the contenteditable='false' span instead of staying at the top level. This is messing up our editing experience because when we try to insert text into the document we will inadvertently try to insert it into the area of the document reperesented by the non-editable portion.

I hope my explanation is clear. Any advice is appreciated.

Thank you.

Reply all
Reply to author
Forward
0 new messages