Skip to content

Commit 87623f7

Browse files
committed
fix(ui-tree-browser): treeBrowser collection descriptor is not read by screenreaders
Closes: INSTUI-4296
1 parent 297cd03 commit 87623f7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/ui-tree-browser/src/TreeBrowser/TreeCollection/__tests__/TreeCollection.test.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ describe('<TreeCollection />', async () => {
360360
const collection = await TreeCollectionLocator.find()
361361
const childs = await collection.findAllItems()
362362
const childNameArr = childs.map((child) => {
363-
return child.getDOMNode().ariaLabel
363+
return child
364+
.getDOMNode()
365+
.querySelector('span[class$="treeButton__textName"]')?.textContent
364366
})
365367
expect(childNameArr.slice(1)).deep.equal([
366368
'A',
@@ -410,7 +412,9 @@ describe('<TreeCollection />', async () => {
410412
const collection = await TreeCollectionLocator.find()
411413
const childs = await collection.findAllItems()
412414
const childNameArr = childs.map((child) => {
413-
return child.getDOMNode().ariaLabel
415+
return child
416+
.getDOMNode()
417+
.querySelector('span[class$="treeButton__textName"]')?.textContent
414418
})
415419
expect(childNameArr.slice(1)).deep.equal([
416420
'Item A',

packages/ui-tree-browser/src/TreeBrowser/TreeCollection/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ class TreeCollection extends Component<
387387
tabIndex={-1}
388388
/* eslint-disable-next-line jsx-a11y/role-has-required-aria-props */
389389
role="treeitem"
390-
aria-label={this.props.name}
390+
aria-label={`${this.props.name}${
391+
this.props.descriptor ? ` ${this.props.descriptor}` : ''
392+
}`}
391393
aria-level={level}
392394
aria-posinset={position}
393395
aria-setsize={this.props.numChildren}

0 commit comments

Comments
 (0)