Skip to content

PDOMInstance

Overview

An instance that is synchronously created, for handling accessibility needs.

Consider the following example:

We have a node structure: A B ( accessible ) C (accessible ) D E (accessible) G (accessible) F H (accessible)

Which has an equivalent accessible instance tree: root AB ABC ABCDE ABCDEG ABCDFH

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class PDOMInstance

import { PDOMInstance } from 'scenerystack/scenery';

Constructor

new PDOMInstance( parent : PDOMInstance | null, display : Display, trail : Trail )

Instance Methods

initializePDOMInstance( parent : PDOMInstance | null, display : Display, trail : Trail ) : PDOMInstance

Initializes a PDOMInstance, implements construction for pooling.

@param parent - null if this PDOMInstance is root of PDOMInstance tree @param display @param trail - trail to node for this PDOMInstance @returns - Returns 'this' reference, for chaining

addConsecutiveInstances( pdomInstances : PDOMInstance[] )

Adds a series of (sorted) accessible instances as children.

removeInstancesForTrail( trail : Trail )

Removes any child instances that are based on the provided trail.

removeAllChildren()

Removes all of the children.

findChildWithTrail( trail : Trail ) : PDOMInstance | null

Returns a PDOMInstance child (if one exists with the given Trail), or null otherwise.

isGloballyVisible() : boolean

Returns whether the parallel DOM for this instance and its ancestors are not hidden.

updateTransformTracker( pdomTransformSourceNode : Node | null )

Create a new TransformTracker that will observe transforms along the trail of this PDOMInstance OR the provided pdomTransformSourceNode. See ParallelDOM.setPDOMTransformSourceNode(). The The source Node must not use DAG so that its trail is unique.

getPDOMInstanceUniqueId() : string

Depending on what the unique ID strategy is, formulate the correct id for this PDOM instance.

toString() : string

For debugging purposes.

freeToPool()

Instance Properties

parent : PDOMInstance | null

trail : Trail | null

isRootInstance : boolean

node : Node | null

children : PDOMInstance[]

peer : PDOMPeer | null

Static Methods

uniqueIdToTrail( display : Display, uniqueId : string ) : Trail | null

@param display @param uniqueId - value returned from PDOMInstance.getPDOMInstanceUniqueId() @returns null if there is no path to the unique id provided.

guessVisualTrail( trail : Trail, rootNode : Node ) : Trail

Since a "Trail" on PDOMInstance can have discontinuous jumps (due to pdomOrder), this finds the best actual visual Trail to use, from the trail of a PDOMInstance to the root of a Display.

@param trail - trail of the PDOMInstance, which can containe "gaps" @param rootNode - root of a Display

Static Properties

pool : Pool

(readonly)

Source Code

See the source for PDOMInstance.ts in the scenery repository.