Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js

Issue 2671203002: DevTools: Added ARIA roles & states to treeoutline (Closed)
Patch Set: updated Layout tests with expected ARIA attributes Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
index 74e58e0fdc204d4a2f32051233d53582a631d2c6..4fafc448cb027ea8c235ba50d9ea8e924a3a2af1 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
@@ -48,6 +48,7 @@ UI.TreeOutline = class extends Common.Object {
if (this._focusable)
this.contentElement.setAttribute('tabIndex', -1);
this.element = this.contentElement;
+ UI.ARIAUtils.markAsTree(this.element);
// Adjust to allow computing margin-left for the selection element.
// Check the padding-left for the li element for correct value.
@@ -336,10 +337,12 @@ UI.TreeElement = class {
this._listItemNode.addEventListener('mousedown', this._handleMouseDown.bind(this), false);
this._listItemNode.addEventListener('click', this._treeElementToggled.bind(this), false);
this._listItemNode.addEventListener('dblclick', this._handleDoubleClick.bind(this), false);
+ UI.ARIAUtils.markAsTreeitem(this._listItemNode);
this._childrenListNode = createElement('ol');
this._childrenListNode.parentTreeElement = this;
this._childrenListNode.classList.add('children');
+ UI.ARIAUtils.markAsGroup(this._childrenListNode);
this._hidden = false;
this._selectable = true;
@@ -705,8 +708,12 @@ UI.TreeElement = class {
this._expandable = expandable;
this._listItemNode.classList.toggle('parent', expandable);
- if (!expandable)
+ if (!expandable) {
this.collapse();
+ UI.ARIAUtils.unsetExpanded(this._listItemNode);
+ } else {
+ UI.ARIAUtils.setExpanded(this._listItemNode, false);
+ }
}
/**
@@ -838,6 +845,7 @@ UI.TreeElement = class {
return;
this._listItemNode.classList.remove('expanded');
this._childrenListNode.classList.remove('expanded');
+ UI.ARIAUtils.setExpanded(this._listItemNode, false);
this.expanded = false;
this.oncollapse();
if (this.treeOutline)
@@ -866,6 +874,7 @@ UI.TreeElement = class {
this._populateIfNeeded();
this._listItemNode.classList.add('expanded');
this._childrenListNode.classList.add('expanded');
+ UI.ARIAUtils.setExpanded(this._listItemNode, true);
if (this.treeOutline) {
this.onexpand();
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/ARIAUtils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698