Simple repro case attached. This is simply a body with some text in it, followed by two <br> elements.
Mouse-based repro: triple-click on "some text" to select the whole line. Expected selection:
Start at staticText of "some text", offset 0. End at the end of that element.
Actual selection:
> anchorObject.role
"staticText"
> anchorObject.name
"Some text "
> focusObject.role
"genericContainer"
> focusOffset
11
Here the focusObject is the container holding the anchorObject.
I believe (after speaking with dtseng a few weeks ago) we don't expect the second part of the selection, the focusObject, to come earlier in the Automation tree than the first object. Please feel free to close this if that is expected behavior.
|
Deleted:
selection-brs.html
68 bytes
|
Comment 1 by katie@chromium.org
, Feb 20 2018Another example is attached. This is a paragraph of text, followed by a <br>, followed by another paragraph. When the first paragraph is selected by triple-clicking on it, the selection is: > anchorObject.name "Selected text" > anchorOffset 0 > focusObject.name undefined > focusObject.role "rootWebArea" > focusOffset 15 The focusObject is not only before the anchorObject in the tree, but also the focusOffset is much further than the anchorObject's length. "selected text" is only 13 characters long, but the focusOffset is 15. This seems like a true bug. Note that if the <br> element is removed, selection seems to work as expected. Javascript repro steps for this second example: var selection = window.getSelection() selection.removeAllRanges() var range = document.createRange() var p = document.getElementsByTagName("p")[0] range.setStart(p, 0) var br = document.getElementsByTagName("br")[0] range.setEnd(br, 0) selection.removeAllRanges() selection.addRange(range)101 bytes
101 bytes View Download