New issue
Advanced search Search tips

Issue 619338 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Selection in inline element with contenteditable does not account for inserted line breaks

Reported by jameshfisher@gmail.com, Jun 11 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

Example URL:
https://jsfiddle.net/4pekem0z/

Steps to reproduce the problem:
Create a `<span>` with `contenteditable`.

Set up Javascript to do, once per second: get the user's selection, then set the selection to the same as the current selection.

Place the cursor in the `<span>`.  Hit return several times quickly between runs of the Javascript function.

What is the expected behavior?
The Javascript has no effect. Since it just gets the selection and sets it to the same thing, it should be identical to it not running.

What went wrong?
The Javascript function resets the cursor to its original position when it was previously called.  The `<br/>` elements inserted into the `<span>` are kept, however.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 50.0.2661.102  Channel: n/a
OS Version: OS X 10.11.5
Flash Version: Shockwave Flash 21.0 r0

Correct behavior can be seen in Firefox.

Follow the URL to see a demo of this. Note the console.log: the cursor index appears to not be updated after inserting new <br>s in the <span>.
 

Comment 1 by mkwst@chromium.org, Jun 13 2016

Cc: yosin@chromium.org
Components: -Blink Blink>Editing
Status: Untriaged (was: Unconfirmed)
yosin@: Can you triage this?

Comment 2 by yosin@chromium.org, Jun 27 2016

Cc: -yosin@chromium.org
Components: -Blink>Editing Blink>TextSelection
Labels: -OS-Mac OS-All
Status: Available (was: Untriaged)
It seems visible canonicalization moves caret.

Comment 3 by tkent@chromium.org, Oct 12 2016

Components: -Blink>TextSelection Blink>Editing>Selection

Comment 4 by yosin@chromium.org, Oct 4 2017

Labels: Pri-3
Project Member

Comment 5 by sheriffbot@chromium.org, Oct 4

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment