//cc @isidorn
This commit is contained in:
Benjamin Pasero 2020-05-20 16:23:13 +02:00
parent 2eb68e527e
commit 571beebe9c
3 changed files with 10 additions and 7 deletions

View file

@ -42,14 +42,16 @@ export const DEFAULT_EDITOR_PART_OPTIONS: IEditorPartOptions = {
splitSizing: 'distribute'
};
export function computeEditorAriaLabel(input: IEditorInput, group: IEditorGroup | undefined, groupCount: number): string {
export function computeEditorAriaLabel(input: IEditorInput, index: number | undefined, group: IEditorGroup | undefined, groupCount: number): string {
let ariaLabel = input.getAriaLabel();
if (group && !group.isPinned(input)) {
ariaLabel = `${ariaLabel}, ${localize('preview', "preview")}`;
ariaLabel = localize('preview', "{0}, preview", ariaLabel);
}
if (group && group.isSticky(input)) {
ariaLabel = `${ariaLabel}, ${localize('pinned', "pinned")}`;
if (group && group.isSticky(index ?? input)) {
ariaLabel = localize('pinned', "{0}, pinned", ariaLabel);
}
// Apply group information to help identify in
// which group we are (only if more than one group
// is actually opened)

View file

@ -882,13 +882,14 @@ export class TabsTitleControl extends TitleControl {
private computeTabLabels(): void {
const { labelFormat } = this.accessor.partOptions;
const { verbosity, shortenDuplicates } = this.getLabelConfigFlags(labelFormat);
// Build labels and descriptions for each editor
const labels = this.group.editors.map(editor => ({
const labels = this.group.editors.map((editor, index) => ({
editor,
name: editor.getName(),
description: editor.getDescription(verbosity),
title: withNullAsUndefined(editor.getTitle(Verbosity.LONG)),
ariaLabel: computeEditorAriaLabel(editor, this.group, this.editorGroupService.count)
ariaLabel: computeEditorAriaLabel(editor, index, this.group, this.editorGroupService.count)
}));
// Shorten labels as needed

View file

@ -103,7 +103,7 @@ export abstract class BaseTextEditor extends BaseEditor implements ITextEditorPa
}
private computeAriaLabel(): string {
return this._input ? computeEditorAriaLabel(this._input, this.group, this.editorGroupService.count) : localize('editor', "Editor");
return this._input ? computeEditorAriaLabel(this._input, undefined, this.group, this.editorGroupService.count) : localize('editor', "Editor");
}
protected getConfigurationOverrides(): IEditorOptions {