提交 47ed4863 编写于 作者: I isidor

explorer: improve aria-level computation of compact folders

#107235
上级 ea78dd7b
......@@ -186,7 +186,7 @@ function asListOptions<T, TFilterData, TRef>(modelProvider: () => ITreeModel<T,
return options.accessibilityProvider!.getWidgetAriaLabel();
},
getWidgetRole: options.accessibilityProvider && options.accessibilityProvider.getWidgetRole ? () => options.accessibilityProvider!.getWidgetRole!() : () => 'tree',
getAriaLevel(node) {
getAriaLevel: options.accessibilityProvider && options.accessibilityProvider.getAriaLevel ? (node) => options.accessibilityProvider!.getAriaLevel!(node.element) : (node) => {
return node.depth;
},
getActiveDescendantId: options.accessibilityProvider.getActiveDescendantId && (node => {
......
......@@ -255,7 +255,8 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
@IThemeService private readonly themeService: IThemeService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExplorerService private readonly explorerService: IExplorerService,
@ILabelService private readonly labelService: ILabelService
@ILabelService private readonly labelService: ILabelService,
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService
) {
this.config = this.configurationService.getValue<IFilesConfiguration>();
this.configListener = this.configurationService.onDidChangeConfiguration(e => {
......@@ -491,6 +492,22 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
return element.name;
}
getAriaLevel(element: ExplorerItem): number {
// We need to comput aria level on our own since children of compact folders will otherwise have an incorrect level #107235
let depth = 0;
let parent = element.parent;
while (parent) {
parent = parent.parent;
depth++;
}
if (this.contextService.getWorkbenchState() === WorkbenchState.WORKSPACE) {
depth = depth + 1;
}
return depth;
}
getActiveDescendantId(stat: ExplorerItem): string | undefined {
const compressedNavigationController = this.compressedNavigationControllers.get(stat);
return compressedNavigationController?.currentId;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册