Skip to content

treeLabel and treeLabeledBy are not passed to treeInformation #195

Closed
@dlech

Description

@dlech

Describe the bug
The aria-label of the role="tree" element does not get set to the treeLabel property of a Tree component since the property is not passed on to the treeInformation object.

To Reproduce
Steps to reproduce the behavior:

  • Pick any example that uses the treeLabel property, for example https://rct.lukasbach.com/docs/guides/search
  • Use the accessibility view in Chrome dev tools to view the accessibility tree.
  • See that the label is empty ("")

image

Expected behavior
The label should be assigned (via aria-label attribute).

Additional context
Related code:

const treeContextProps = useMemo<TreeContextProps>(
() => ({
treeId: props.treeId,
rootItem: props.rootItem,
treeLabel: props.treeLabel,
treeLabelledBy: props.treeLabelledBy,
getItemsLinearly: () =>
getItemsLinearly(props.rootItem, viewState ?? {}, environment.items),
treeInformation,
search,
setSearch,
renamingItem,
setRenamingItem,
renderers,
}),
[
environment.items,
props.rootItem,
props.treeId,
props.treeLabel,
props.treeLabelledBy,
renamingItem,
renderers,
search,
treeInformation,
viewState,
]
);

This copies the treeId and rootItem properties but not the treeLabel and treeLabelledBy properties that are expected by the TreeConfiguration interface that TreeInformation inherits.

export interface TreeConfiguration {
treeId: string;
rootItem: string;
treeLabel?: string;
treeLabelledBy?: string;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions