Skip to content
D
Documentation

A11y — interfaces

reference
5 min readUpdated

Interfaces

Import these from @grafloria/renderer.

Interfaces

Adjacency

ts
interface Adjacency

Properties

NameTypeDefaultDescription
outgoingMap<string, Incidence[]>nodeId → edges leaving it.
incomingMap<string, Incidence[]>nodeId → edges arriving at it.

ContainmentResult

ts
interface ContainmentResult

Properties

NameTypeDefaultDescription
actionContainmentAction
dxnumberWorld-space delta applied (or to be applied, when animating).
dynumber
zoom?numberZoom applied, when action === 'zoom'.

DiagramLike

The minimum of DiagramModel these pure functions need.

ts
interface DiagramLike

Members

  • getNode(id: string): NodeModel | undefined
  • getNodes(): NodeModel[]
  • getLink(id: string): LinkModel | undefined
  • getLinks(): LinkModel[]
  • getNodeByPortId?(portId: string): NodeModel | undefined
  • getGroups?(): unknown[]

DiagramOutline

ts
interface DiagramOutline

Properties

NameTypeDefaultDescription
summarystringNatural-language summary, read when focus enters the diagram.
rootsOutlineNode[]The containment forest, in reading order.
flatOutlineNode[]Flat reading-order view — what the roving tabindex walks.
entryPointsstring[]
terminalsstring[]
isolatedstring[]
cyclesstring[][]
nodeCountnumber
edgeCountnumber
componentCountnumber
edges{ linkId: string; text: string }[]Every edge, as an AT-readable sentence (the edge list of the mirror).
signaturestringCheap change key — see outlineSignature.

FocusContainmentOptions

ts
interface FocusContainmentOptions

Properties

NameTypeDefaultDescription
padding?numberCSS-pixel margin kept between the focused element and the viewport edge.
durationMs?numberPan animation duration, ms. 0 (or reduced motion) → instant.
reducedMotion?() => booleanOverride reduced-motion detection (tests).
now?() => numberInjected clock/frame source (tests).
requestFrame?(cb: (t: number) => void) => number
cancelFrame?(handle: number) => void

Incidence

Graph TOPOLOGY — the structural facts an assistive-technology user cannot see: which nodes start the flow, which end it, what cycles back, what is unreachable.

This is the analysis engine behind two cards:

  • follow-edge keyboard traversal — walking the real graph, not the geometry;
  • the navigable outline + natural-language summary.

Pure, framework-free, model-in / facts-out. No DOM, no rendering.

.

ts
interface Incidence

Properties

NameTypeDefaultDescription
linkLinkModelThe link.
otherIdstringThe node at the OTHER end of it.
direction'outgoing' | 'incoming'Are we the source (outgoing) or the target (incoming)?

LiveRegionOptions

ts
interface LiveRegionOptions

Properties

NameTypeDefaultDescription
coalesceMs?numberAnnouncements arriving within this many ms of the previous one REPLACE it rather than following it. 0 disables coalescing (tests use this).
now?() => numberInjected clock, so tests need no timers.
schedule?(fn: () => void, ms: number) => unknownInjected scheduler, so tests need no real setTimeout.
cancel?(handle: unknown) => void

OutlineEdgeRef

The DIAGRAM OUTLINE — a screen-reader-navigable TEXT MIRROR of the graph.

This is the capability no competitor ships. Mermaid is read-only pictures; React Flow / GoJS / JointJS give a screen reader, at best, a bag of labelled shapes with no edges. None of them give an AT user the topology: where a flow starts, what each node leads to, what loops back, what is unreachable.

The outline is that topology, as a structured tree the AT virtual cursor can browse with its normal list/tree keys — plus a natural-language summary read on entry, so the user knows the shape of the thing before walking it.

Pure model → outline. Rendering it to DOM is outline-view.ts's job; keeping the two apart is what lets us unit-test the content with no DOM at all.

.

ts
interface OutlineEdgeRef

Properties

NameTypeDefaultDescription
linkIdstring
targetIdstring
targetNamestring
label?stringThe edge's own label ("yes" / "no" on a decision), if any.
closesCyclebooleanTrue when this edge closes a cycle — the single most useful fact.

OutlineNode

ts
interface OutlineNode

Properties

NameTypeDefaultDescription
nodeIdstring
namestring
roleDescriptionstringHuman shape name — "Decision", "Process".
incomingnumber
outgoingnumber
targetsOutlineEdgeRef[]Where this node leads.
childrenOutlineNode[]Nested nodes (group / parent containment).
isEntryPointboolean
isTerminalboolean
isIsolatedboolean
inCyclebooleanParticipates in at least one cycle.
indexnumber1-based position in reading order, and the total — "node 3 of 12".
totalnumber

OutlineViewOptions

The outline's DOM MIRROR: a visually-hidden, semantically-structured tree the AT virtual cursor browses with its ordinary list/tree keys.

Structure (all off-screen, never focusable by Tab — the canvas owns the tab stop; this is virtual-cursor territory):

{natural-language summary}

    • …children…
    …

THRASH CONTROL — the non-negotiable. update() is safe to call on every frame: it recomputes only the outline SIGNATURE (ids/names/states/endpoints, never geometry) and returns immediately when it is unchanged. A quiet frame, and a pure-drag frame, do ZERO DOM work. getRebuildCount() exists so a test can PROVE it rather than trust it.

.

ts
interface OutlineViewOptions

Properties

NameTypeDefaultDescription
label?stringAccessible name of the outline region.
diagramType?stringDiagram type, used in the roledescription ("Flowchart diagram").
includeEdgeList?booleanInclude the per-edge list. Default true.

Topology

ts
interface Topology

Properties

NameTypeDefaultDescription
adjacencyAdjacency
entryPointsNodeModel[]Nodes with no incoming edges — where a reader should start.
terminalsNodeModel[]Nodes with no outgoing edges — where flows terminate.
isolatedNodeModel[]Nodes with neither incoming nor outgoing edges.
cyclesstring[][]Each cycle as the ordered node ids around it.
componentsstring[][]Connected components (undirected), as node-id lists.
orderedNodeModel[]Nodes in reading order (top-to-bottom, then left-to-right).

Was this page helpful?

A11y — interfaces — Grafloria