Setting the selection on an empty span selects the next span instead |
||||
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);
,
Oct 12 2016
,
Nov 30 2016
,
Mar 23 2017
,
Apr 25 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by yosin@chromium.org
, Jul 21 2016Status: Started (was: Assigned)