Class AccessibilityTreeSnapshot
- Namespace
- Forma
- Assembly
- Forma.dll
A flat, ordered, serializable projection of the accessibility tree at one instant.
Flat rather than nested because every consumer wants it that way: a diff needs to find a node by id without a search, a transport wants no recursion, and a locator wants to filter. Order is depth-first in draw order, so reading the list top to bottom matches what a person sees.
public sealed class AccessibilityTreeSnapshot
- Inheritance
-
AccessibilityTreeSnapshot
- Inherited Members
Properties
FocusedId
Id of the focused node, or 0 when nothing has focus.
public int FocusedId { get; }
Property Value
IsModalActive
Whether a modal popup was up. When it is, the snapshot contains only that popup's subtree, matching what input does — anything behind a modal is unreachable, so reporting it would invite a consumer to act on something a person could not.
public bool IsModalActive { get; }
Property Value
Nodes
Every visible node, depth-first in draw order.
public IReadOnlyList<AccessibilityNode> Nodes { get; }
Property Value
Methods
ToLayoutText()
The same tree as ToText() with each node's bounds, for working out why something is laid out the way it is.
public string ToLayoutText()
Returns
Remarks
Deliberately not what ToText() produces, and deliberately not for goldens: bounds churn with window size and would make every unrelated change look like a regression. This is the other half of that trade -- a view you reach for when a control is the wrong size and you need to know which ancestor decided that, which is the question a golden tree cannot answer.
ToString()
A short summary for logs; use ToText() for the tree itself.
public override string ToString()
Returns
ToText()
Indented role "name" lines, one per node. Stable enough to commit as a golden file:
bounds and ids are deliberately omitted, because they churn with window size and
allocation order and would make every unrelated change look like a regression.
public string ToText()
Returns
TryGetNode(int, out AccessibilityNode)
Finds a node by id without scanning, which is what makes diffing cheap.
public bool TryGetNode(int id, out AccessibilityNode node)
Parameters
idintnodeAccessibilityNode