feat: add role prop to nodes

This commit is contained in:
Abbey Yacoe
2025-05-26 17:08:29 +02:00
parent 0af2f2801d
commit ba9df8eaf8
4 changed files with 21 additions and 4 deletions
+8
View File
@@ -73,6 +73,13 @@ export type NodeBase<
*/
origin?: NodeOrigin;
handles?: NodeHandle[];
/**
* The ARIA role attribute for the node element, used for accessibility.
* Common values for nodes might be 'button', 'group', 'listitem', etc.
* When not specified, focusable nodes default to 'button' role.
* @default "button" (for focusable nodes)
*/
role?: NodeRole;
measured?: {
width?: number;
height?: number;
@@ -180,3 +187,4 @@ export type Align = 'center' | 'start' | 'end';
export type NodeLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType>;
export type ParentLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, Map<string, NodeType>>;
export type NodeRole = 'button' | 'group' | 'listitem' | 'application' | 'region' | 'none' | null;