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

Issue 797819 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug
STS
Team-Accessibility



Sign in to add a comment

Document selection params incorrect for some divs - anchor offset is 1 instead of 0.

Project Member Reported by katie@chromium.org, Dec 27 2017

Issue description

In the attached example, when the first word is selected by double-clicking on it, the selection params obtained from the automation API start at index 1 instead of index 0, i.e. they skip the first letter.

I found this on etsy.com and boiled it down to the sample attached. It appears it's related to the inline-block span followed by a text span.

Here's the selection params obtained by doing chrome.automation.getFocus:

focusedNode.root.anchorObject.role
"paragraph"
focusedNode.root.anchorOffset
1
^expected 0!

focusedNode.root.anchorObject.children.length
1
focusedNode.root.anchorObject.children[0].role
"staticText"
focusedNode.root.anchorObject.children[0].name
"Skips first letter"


In addition, setting these same selection params with chrome.automation.setDocumentSelection results in a DIFFERENT region being selected than was previously selected.

But using 0 for anchorOffset when setting the selection params results in the CORRECT selection.
 
etsy.html
227 bytes View Download

Comment 1 by katie@chromium.org, Dec 27 2017

Cc: katie@chromium.org

Comment 2 by katie@chromium.org, Feb 20 2018

More info:

This does *not* reproduce if the text span has an ID set.
This *does* reproduce with the following JS:

var selection = window.getSelection()
var range = document.createRange()
var span = document.getElementsByTagName("span")[1]
range.setStart(span, 0)
range.setEnd(span, 1)

At this point, highlight looks correct, but the result of getting the selection from Automation has a start that is off by 1.

Comment 3 by katie@chromium.org, Mar 8 2018

Labels: OS-Chrome

Comment 4 by katie@chromium.org, Mar 19 2018

Components: UI>Accessibility>SelectToSpeak

Comment 5 by katie@chromium.org, Mar 19 2018

Components: -UI>Accessibility
Components: UI>Accessibility
Status: Available (was: Untriaged)
Can I take this issue if there is no one working on this?
Labels: STS_selection
This bug requires improvements to selection and may automatically be fixed when relevant selection fixes are available through the automation API.

Sign in to add a comment