Chromium Code Reviews| Index: ui/webui/resources/js/cr/ui/tree.js |
| diff --git a/ui/webui/resources/js/cr/ui/tree.js b/ui/webui/resources/js/cr/ui/tree.js |
| index aa9199e9c2dadd42a6aa61f2164e799bc15842ad..c7bfe49eab67631fd5e9749c6933dcda078723d3 100644 |
| --- a/ui/webui/resources/js/cr/ui/tree.js |
| +++ b/ui/webui/resources/js/cr/ui/tree.js |
| @@ -256,7 +256,7 @@ cr.define('cr.ui', function() { |
| '<span class=expand-icon></span>' + |
| '<span class=tree-label></span>' + |
| '</div>' + |
| - '<div class=tree-children></div>'; |
| + '<div class=tree-children role=group></div>'; |
|
dpapad
2016/08/03 20:31:19
All those class= statements are missing quotes, sh
|
| treeItem.setAttribute('role', 'treeitem'); |
| return treeItem; |
| })(); |
| @@ -280,7 +280,10 @@ cr.define('cr.ui', function() { |
| * Initializes the element. |
| */ |
| decorate: function() { |
| - |
| + var labelId = 'tree-item-label-autogen-id-' + |
| + treeItemAutoGeneratedIdCounter; |
| + this.labelElement.id = labelId; |
| + this.setAttribute('aria-labelledby', labelId); |
| }, |
| /** |
| @@ -393,6 +396,7 @@ cr.define('cr.ui', function() { |
| if (b) { |
| if (this.mayHaveChildren_) { |
| this.setAttribute('expanded', ''); |
| + this.setAttribute('aria-expanded', 'true'); |
| treeChildren.setAttribute('expanded', ''); |
| cr.dispatchSimpleEvent(this, 'expand', true); |
| this.scrollIntoViewIfNeeded(false); |
| @@ -405,6 +409,11 @@ cr.define('cr.ui', function() { |
| this.selected = true; |
| } |
| this.removeAttribute('expanded'); |
| + if (this.mayHaveChildren_) { |
|
dpapad
2016/08/03 20:31:19
Nit: No need for curly braces.
|
| + this.setAttribute('aria-expanded', 'false'); |
| + } else { |
| + this.removeAttribute('aria-expanded'); |
| + } |
| treeChildren.removeAttribute('expanded'); |
| cr.dispatchSimpleEvent(this, 'collapse', true); |
| } |
| @@ -520,8 +529,10 @@ cr.define('cr.ui', function() { |
| var rowItem = this.firstElementChild; |
| this.setAttribute('has-children', b); |
| rowItem.setAttribute('has-children', b); |
| - if (b) |
| + if (b) { |
| this.mayHaveChildren_ = true; |
| + this.setAttribute('aria-expanded', 'false'); |
| + } |
| }, |
| /** |