diff --git a/src/vs/base/browser/ui/list/listWidget.ts b/src/vs/base/browser/ui/list/listWidget.ts index a70969206fb9cbcbf9a0b2e565284a56dec1dff5..40105bc41f44a437e866ff29575d25a8a945a1bf 100644 --- a/src/vs/base/browser/ui/list/listWidget.ts +++ b/src/vs/base/browser/ui/list/listWidget.ts @@ -822,7 +822,7 @@ export interface IListOptions extends IListStyles { readonly automaticKeyboardNavigation?: boolean; readonly keyboardNavigationLabelProvider?: IKeyboardNavigationLabelProvider; readonly keyboardNavigationDelegate?: IKeyboardNavigationDelegate; - readonly ariaRole?: ListAriaRootRole; + readonly ariaRole?: ListAriaRootRole | string; readonly ariaLabel?: string; readonly keyboardSupport?: boolean; readonly multipleSelectionSupport?: boolean; @@ -1198,11 +1198,7 @@ export class List implements ISpliceable, IDisposable { this.view = new ListView(container, virtualDelegate, renderers, viewOptions); - if (typeof _options.ariaRole !== 'string') { - this.view.domNode.setAttribute('role', ListAriaRootRole.TREE); - } else { - this.view.domNode.setAttribute('role', _options.ariaRole); - } + this.updateAriaRole(); this.styleElement = DOM.createStyleSheet(this.view.domNode); @@ -1612,10 +1608,19 @@ export class List implements ISpliceable, IDisposable { this.view.domNode.removeAttribute('aria-activedescendant'); } - this.view.domNode.setAttribute('role', 'tree'); + this.updateAriaRole(); + DOM.toggleClass(this.view.domNode, 'element-focused', focus.length > 0); } + private updateAriaRole(): void { + if (typeof this.options.ariaRole !== 'string') { + this.view.domNode.setAttribute('role', ListAriaRootRole.TREE); + } else { + this.view.domNode.setAttribute('role', this.options.ariaRole); + } + } + private _onSelectionChange(): void { const selection = this.selection.get(); diff --git a/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts b/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts index 863dd01c1c7424d139b6e29aa50cfc3b658d6f3c..33f6f863ec277266d11cf1f22b876901824c0fb8 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsToasts.ts @@ -164,6 +164,7 @@ export class NotificationsToasts extends Themable { // Create toast with item and show const notificationList = this.instantiationService.createInstance(NotificationsList, notificationToast, { + ariaRole: 'dialog', // https://github.com/microsoft/vscode/issues/82728 ariaLabel: localize('notificationsToast', "Notification Toast"), verticalScrollMode: ScrollbarVisibility.Hidden });