提交 19985670 编写于 作者: I isidor

fixes #101442

上级 34928ddb
......@@ -30,12 +30,14 @@ export class MainThreadStatusBar implements MainThreadStatusBarShape {
$setEntry(id: number, statusId: string, statusName: string, text: string, tooltip: string | undefined, command: Command | undefined, color: string | ThemeColor | undefined, alignment: MainThreadStatusBarAlignment, priority: number | undefined, accessibilityInformation: IAccessibilityInformation): void {
// if there are icons in the text use the tooltip for the aria label
let ariaLabel: string;
let role: string | undefined = undefined;
if (accessibilityInformation) {
ariaLabel = accessibilityInformation.label;
role = accessibilityInformation.role;
} else {
ariaLabel = text ? text.replace(MainThreadStatusBar.CODICON_REGEXP, (_match, codiconName) => codiconName) : '';
}
const entry: IStatusbarEntry = { text, tooltip, command, color, ariaLabel };
const entry: IStatusbarEntry = { text, tooltip, command, color, ariaLabel, role };
if (typeof priority === 'undefined') {
priority = 0;
......
......@@ -765,6 +765,9 @@ class StatusbarEntryItem extends Disposable {
this.container.setAttribute('aria-label', entry.ariaLabel);
this.labelContainer.setAttribute('aria-label', entry.ariaLabel);
}
if (!this.entry || entry.role !== this.entry.role) {
this.labelContainer.setAttribute('role', entry.role || 'button');
}
// Update: Tooltip (on the container, because label can be disabled)
if (!this.entry || entry.tooltip !== this.entry.tooltip) {
......
......@@ -885,6 +885,12 @@ export class TimelinePane extends ViewPane {
}
return element.accessibilityInformation ? element.accessibilityInformation.label : localize('timeline.aria.item', "{0}: {1}", element.relativeTime ?? '', element.label);
},
getRole(element: TreeElement): string {
if (isLoadMoreCommand(element)) {
return 'treeitem';
}
return element.accessibilityInformation && element.accessibilityInformation.role ? element.accessibilityInformation.role : 'treeitem';
},
getWidgetAriaLabel(): string {
return localize('timeline', "Timeline");
}
......
......@@ -33,6 +33,12 @@ export interface IStatusbarEntry {
*/
readonly ariaLabel: string;
/**
* Role of the status bar entry which defines how a screen reader interacts with it.
* Default is 'button'.
*/
readonly role?: string;
/**
* An optional tooltip text to show when you hover over the entry
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册