Chrome exposes the following attributes on the root of an accessibility to indicate a tree selection:
- AutomationRootNode.prototype.anchorNode
- AutomationRootNode.prototype.focusNode
- AutomationRootNode.prototype.anchorOffset
- AutomationRootNode.prototype.focusOffset
This indicates a selection precisely. To get the proper behavior, see the Selection api in the W3C specification for it.
Highlights:
- the *Node objects are AutomationNode
- anchor/focus indicates the start/end of the selection along with the *Offset
- if the node is text, the offset is interpreted as a text / character offset into the |name| property
- if the node is not text, the offset is interpreted as a index into the node's children
- the exception is a text field, where the offset is interpreted as an offset into the text content (computed recursively)
For example, a simple text field could have its anchor/focus set to the text field and the offset an absolute index into the text field's value.
Comment 1 by yawano@chromium.org
, Mar 30 2018Components: UI>Accessibility>SelectToSpeak