New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 629865 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocked on:
issue 669811



Sign in to add a comment

Setting the selection on an empty span selects the next span instead

Project Member Reported by nek...@chromium.org, Jul 20 2016

Issue description

Setting the selection via JavaScript on an empty span doesn't work properly.
This is a high priority bug that affects accessibility in Google Docs. Could you take it on or help me find the right owner?

1. Open the attached HTML file and focus the content editable.
2. Hit the right arrow three times. Focus has moved to the blank line below the line containing "abc" but the cursor appears on the line below that, i.e. the second blank line.
3. Hit the right arrow one more time. Focus has now moved to the second blank line, but the cursor appears at the beginning of the line containing "def".
4. Hit the right arrow one more time. Focus has now moved to the beginning of the line containing "def" and the browser now matches expectations.

Most important snippets from HTML file:
<div role="textbox" contenteditable>
<p>
<span>abc</span><span></span>
</p>
<br><span></span>
<br><span></span>
<p>
<span>def</span><span></span>
</p>
</div>

var range = document.createRange();
  var children = document.getElementsByTagName('span');
  range.setStart(children[el], ind);
  range.setEnd(children[el], ind);
  var selection = window.getSelection();
  selection.removeAllRanges();
  selection.addRange(range);
 

Comment 1 by yosin@chromium.org, Jul 21 2016

Components: -Blink>Editing Blink>TextSelection
Status: Started (was: Assigned)
This is due by visible position canonicalization. We're working to get rid of visible position canonicalization.

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

Components: -Blink>TextSelection Blink>Editing>Selection

Comment 3 by yosin@chromium.org, Nov 30 2016

Blockedon: 669811

Comment 4 by yosin@chromium.org, Mar 23 2017

Owner: ----
Status: Available (was: Started)

Comment 5 by yosin@chromium.org, Apr 25 2017

Status: Fixed (was: Available)
Mark Fixed since M58.

See https://jsfiddle.net/a0gpqgz5/1/

Sign in to add a comment