diff --git a/projects/angular/src/data/tree-view/recursive-children.ts b/projects/angular/src/data/tree-view/recursive-children.ts index 2a4a52567a..e827c412db 100644 --- a/projects/angular/src/data/tree-view/recursive-children.ts +++ b/projects/angular/src/data/tree-view/recursive-children.ts @@ -23,7 +23,7 @@ import { TreeFeaturesService } from './tree-features.service'; `, host: { - '[attr.role]': '"group"', // Safari + VO needs direct relationship between treeitem and group; no element should exist between them + '[attr.role]': 'role', // Safari + VO needs direct relationship between treeitem and group; no element should exist between them }, }) /** @@ -37,6 +37,7 @@ export class RecursiveChildren { @Input('children') children: TreeNodeModel[]; subscription: Subscription; + role: string; constructor(public featuresService: TreeFeaturesService, @Optional() private expandService: IfExpandService) { if (expandService) { @@ -51,6 +52,10 @@ export class RecursiveChildren { } } + ngAfterContentInit() { + this.setAriaRoles(); + } + shouldRender() { return ( this.featuresService.recursion && @@ -73,4 +78,8 @@ export class RecursiveChildren { this.subscription.unsubscribe(); } } + + private setAriaRoles() { + this.role = this.parent ? 'group' : null; + } }