Issue metadata
Sign in to add a comment
|
Document selection params incorrect for some divs - anchor offset is 1 instead of 0. |
||||||||||||||||||||||
Issue descriptionIn 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.
,
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.
,
Mar 8 2018
,
Mar 19 2018
,
Mar 19 2018
,
Sep 7
,
Sep 8
Can I take this issue if there is no one working on this?
,
Sep 27
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 |
|||||||||||||||||||||||
Comment 1 by katie@chromium.org
, Dec 27 2017