Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectTree/List: Add ariaRootRole option. Addresses: #65939 #67092

Merged
merged 2 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address @joaomoreno tweaks
  • Loading branch information
cleidigh committed Jan 25, 2019
commit 2fe03c4e196ae863cf3a62b16e9f78ff65c7ab02
2 changes: 1 addition & 1 deletion src/vs/base/browser/ui/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface IIdentityProvider<T> {
}

// Default tree/list root role 'tree' does not support interactive element labeling, 'form' does
export enum EListAriaRootRole {
export enum ListAriaRootRole {
TREE = 'tree', // default tree structure role
FORM = 'form' // unstructured - allows interactive elements within tree/list structure
}
Expand Down
12 changes: 6 additions & 6 deletions src/vs/base/browser/ui/list/listWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import { StandardKeyboardEvent, IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Event, Emitter, EventBufferer } from 'vs/base/common/event';
import { domEvent } from 'vs/base/browser/event';
import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent, IListMouseEvent, IListTouchEvent, IListGestureEvent, IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, EListAriaRootRole } from './list';
import { IListVirtualDelegate, IListRenderer, IListEvent, IListContextMenuEvent, IListMouseEvent, IListTouchEvent, IListGestureEvent, IIdentityProvider, IKeyboardNavigationLabelProvider, IListDragAndDrop, IListDragOverReaction, ListAriaRootRole } from './list';
import { ListView, IListViewOptions, IListViewDragAndDrop } from './listView';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';
Expand Down Expand Up @@ -785,7 +785,7 @@ export interface IListOptions<T> extends IListStyles {
readonly dnd?: IListDragAndDrop<T>;
readonly enableKeyboardNavigation?: boolean;
readonly keyboardNavigationLabelProvider?: IKeyboardNavigationLabelProvider<T>;
readonly ariaRootRole?: EListAriaRootRole;
readonly ariaRole?: ListAriaRootRole;
readonly ariaLabel?: string;
readonly keyboardSupport?: boolean;
readonly multipleSelectionSupport?: boolean;
Expand Down Expand Up @@ -846,7 +846,7 @@ const DefaultOptions = {
onDragOver() { return false; },
drop() { }
},
ariaRootRole: EListAriaRootRole.TREE
ariaRootRole: ListAriaRootRole.TREE
};

// TODO@Joao: move these utils into a SortedArray class
Expand Down Expand Up @@ -1167,10 +1167,10 @@ export class List<T> implements ISpliceable<T>, IDisposable {

this.view = new ListView(container, virtualDelegate, renderers, viewOptions);

if (typeof _options.ariaRootRole !== 'string') {
this.view.domNode.setAttribute('role', EListAriaRootRole.TREE);
if (typeof _options.ariaRole !== 'string') {
this.view.domNode.setAttribute('role', ListAriaRootRole.TREE);
} else {
this.view.domNode.setAttribute('role', _options.ariaRootRole);
this.view.domNode.setAttribute('role', _options.ariaRole);
}

DOM.addClass(this.view.domNode, this.idPrefix);
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/preferences/browser/settingsTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { alert as ariaAlert } from 'vs/base/browser/ui/aria/aria';
import { Button } from 'vs/base/browser/ui/button/button';
import { Checkbox } from 'vs/base/browser/ui/checkbox/checkbox';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { IListVirtualDelegate, EListAriaRootRole } from 'vs/base/browser/ui/list/list';
import { IListVirtualDelegate, ListAriaRootRole } from 'vs/base/browser/ui/list/list';
import { ISelectOptionItem, SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IObjectTreeOptions, ObjectTree } from 'vs/base/browser/ui/tree/objectTree';
Expand Down Expand Up @@ -1294,7 +1294,7 @@ export class SettingsTree extends ObjectTree<SettingsTreeElement> {
renderers,
{
supportDynamicHeights: true,
ariaRootRole: EListAriaRootRole.FORM,
ariaRole: ListAriaRootRole.FORM,
ariaLabel: localize('treeAriaLabel', "Settings"),
identityProvider: {
getId(e) {
Expand Down