chore: set default role to group, add aria-roledescription
This commit is contained in:
@@ -191,7 +191,8 @@ export function NodeWrapper<NodeType extends Node>({
|
|||||||
onDoubleClick={onDoubleClickHandler}
|
onDoubleClick={onDoubleClickHandler}
|
||||||
onKeyDown={isFocusable ? onKeyDown : undefined}
|
onKeyDown={isFocusable ? onKeyDown : undefined}
|
||||||
tabIndex={isFocusable ? 0 : undefined}
|
tabIndex={isFocusable ? 0 : undefined}
|
||||||
role={node.ariaRole === null ? undefined : node.ariaRole || (isFocusable ? 'button' : undefined)}
|
role={node.ariaRole === null ? undefined : node.ariaRole || (isFocusable ? 'group' : undefined)}
|
||||||
|
aria-roledescription={node.ariaRoleDescription || 'node'}
|
||||||
aria-describedby={disableKeyboardA11y ? undefined : `${ARIA_NODE_DESC_KEY}-${rfId}`}
|
aria-describedby={disableKeyboardA11y ? undefined : `${ARIA_NODE_DESC_KEY}-${rfId}`}
|
||||||
aria-label={node.ariaLabel}
|
aria-label={node.ariaLabel}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -252,7 +252,8 @@
|
|||||||
: undefined}
|
: undefined}
|
||||||
onkeydown={focusable ? onKeyDown : undefined}
|
onkeydown={focusable ? onKeyDown : undefined}
|
||||||
tabIndex={focusable ? 0 : undefined}
|
tabIndex={focusable ? 0 : undefined}
|
||||||
role={node.ariaRole === null ? undefined : node.ariaRole || (focusable ? 'button' : undefined)}
|
role={node.ariaRole === null ? undefined : node.ariaRole || (focusable ? 'group' : undefined)}
|
||||||
|
aria-roledescription={node.ariaRoleDescription || 'node'}
|
||||||
aria-describedby={store.disableKeyboardA11y
|
aria-describedby={store.disableKeyboardA11y
|
||||||
? undefined
|
? undefined
|
||||||
: `${ARIA_NODE_DESC_KEY}-${store.flowId}`}
|
: `${ARIA_NODE_DESC_KEY}-${store.flowId}`}
|
||||||
|
|||||||
@@ -75,12 +75,15 @@ export type NodeBase<
|
|||||||
handles?: NodeHandle[];
|
handles?: NodeHandle[];
|
||||||
/**
|
/**
|
||||||
* The ARIA role attribute for the node element, used for accessibility.
|
* The ARIA role attribute for the node element, used for accessibility.
|
||||||
* Common values for nodes might be 'button', 'group', 'listitem', etc.
|
* @default "group"
|
||||||
* When not specified, focusable nodes default to 'button' role.
|
|
||||||
* @default "button" (for focusable nodes)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ariaRole?: AriaRole;
|
ariaRole?: AriaRole;
|
||||||
|
/**
|
||||||
|
* A description of the node's role, used for accessibility.
|
||||||
|
* @default "node"
|
||||||
|
*/
|
||||||
|
ariaRoleDescription?: string;
|
||||||
measured?: {
|
measured?: {
|
||||||
width?: number;
|
width?: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user