notifications - use aria role "dialog" for toasts (fix #82728) (#82758)

This commit is contained in:
Benjamin Pasero 2019-10-17 16:57:22 +02:00 committed by GitHub
parent b1b9e42e2c
commit c6ffb611be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View file

@ -822,7 +822,7 @@ export interface IListOptions<T> extends IListStyles {
readonly automaticKeyboardNavigation?: boolean;
readonly keyboardNavigationLabelProvider?: IKeyboardNavigationLabelProvider<T>;
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<T> implements ISpliceable<T>, 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<T> implements ISpliceable<T>, 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();

View file

@ -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
});