Documentation
API: primitives (@fragiola/tree-react, @fragiola/tree-vue, @fragiola/tree-angular)

Tree.LiveRegion

The tree's polite live region. It shows the text your announce function returns for each drag step or failed load, and writes none of its own.

Tree.LiveRegion is a role="status", aria-live="polite" element showing the latest text the root's announce returned. The package writes no text: without announce, it stays empty. The WAI-ARIA APG asks a drag and drop to be perceivable without sight; this is where your words go. Hide it visually with your own class.

<Tree.Root<Types> defaultTree={json} announce={announce} aria-label="Files">
    <Tree.Items<Types>>{(item) => <FileItem item={item} />}</Tree.Items>
    <Tree.LiveRegion className="visually-hidden" />
</Tree.Root>

announce receives an AnnounceEvent and returns a string, or undefined to say nothing:

eventfieldswhen
drag-startitemIds, keyboard, target (DropTarget | null)a drag starts (pointer, or keyboard when keyboard is true); a keyboard drag's target is where it starts, announced with the start in one message (no drag-over follows it in the same tick); null for a pointer drag
drag-overitemIds, target (DropTarget | null)the drop target changes; null when there is no valid one
dropitemIds, targetthe items were dropped (one item.move)
drag-cancelitemIdsthe drag was cancelled
load-erroritemId, errora load of an item's children failed

The latest text is also engine.get("announcement"). See Drag and drop.

Props

LiveRegionProps has no props of its own: it takes the common primitive props (on a div), with LiveRegionState.

State

LiveRegionState:

fieldtypedescription
announcementstringthe latest text announce returned ("" before any)

Attributes

attributewhen
role="status"always
aria-live="polite"always
aria-atomicalways
data-tree-part="live-region"always