parent
2eb68e527e
commit
571beebe9c
3 changed files with 10 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue