Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit 5196b92

Browse files
author
Christopher McCulloh
committed
(GH1964) adds hbs support for aria-label and aria-labelledby
1 parent f03d8c2 commit 5196b92

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

Diff for: index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,7 @@ <h5>Choose Folder Location</h5>
20712071
</div>
20722072

20732073
<div class="picker-body well">
2074-
<ul class="tree" id="myPickerTree1" role="tree">
2074+
<ul class="tree" id="myPickerTree1" role="tree" aria-activedescendant="" aria-label="My Tree">
20752075
<li class="tree-branch hidden" data-template="treebranch" role="treeitem" aria-expanded="false">
20762076
<div class="tree-branch-header">
20772077
<button type="button" class="glyphicon icon-caret glyphicon-play"><span class="sr-only">Open</span>
@@ -2113,10 +2113,10 @@ <h5>Choose Folder Location</h5>
21132113
<h2>Tree</h2>
21142114
<div class="thin-box">
21152115
<!-- Utilizes Handlebars templates (see index.js) -->
2116-
<h3>folders selectable (please note structure of treebranch)</h3>
2116+
<h3 id="myTreeLabel">folders selectable (please note structure of treebranch)</h3>
21172117
<div id="myTreeWrapper"></div>
21182118

2119-
<h3>only items selectable (please note structure of treebranch)</h3>
2119+
<h3 id="myTree2Label">only items selectable (please note structure of treebranch)</h3>
21202120
<div id="myTree2Wrapper"></div>
21212121

21222122
</div>

Diff for: index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ define(function (require) {
999999

10001000
var tree = require('hbs!fuelux_templates/tree');
10011001
var $myTreeWrapper = $('#myTreeWrapper');
1002-
$myTreeWrapper.html(tree({id: 'myTree', folderSelect: true}));
1002+
$myTreeWrapper.html(tree({id: 'myTree', labelledBy: 'myTreeLabel', folderSelect: true}));
10031003

10041004
var treeDataSource = function (parentData, callback) {
10051005
log('Opening branch data: ', parentData);
@@ -1099,7 +1099,7 @@ define(function (require) {
10991099
// initialize
11001100
function myTreeInit () {
11011101
var $myTree2Wrapper = $('#myTree2Wrapper');
1102-
$myTree2Wrapper.html(tree({id: 'myTree2'}));
1102+
$myTree2Wrapper.html(tree({id: 'myTree2', labelledBy: 'myTree2Label'}));
11031103

11041104
var callLimit = 200;
11051105
var callCount = 0;

Diff for: templates/handlebars/fuelux/tree.hbs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
<ul class="tree {{#if folderSelect}}tree-folder-select{{/if}}" id="{{#if id}}{{id}}{{else}}myTree{{/if}}" role="tree" aria-activedescendant="">
1+
<ul class="tree {{#if folderSelect}}tree-folder-select{{/if}}"
2+
id="{{#if id}}{{id}}{{else}}myTree{{/if}}"
3+
role="tree"
4+
aria-activedescendant=""
5+
{{#unless labelledBy}}aria-label="{{#if label}}{{label}}{{/if}}"{{/unless}}
6+
{{#if labelledBy}}aria-labelledby="{{labelledBy}}"{{/if}}>
27
<li class="tree-branch hidden" data-template="treebranch" role="treeitem" aria-expanded="false">
38
<div class="tree-branch-header">
49
{{#if folderSelect}}<button type="button" class="glyphicon icon-caret glyphicon-play" tabindex="-1"><span class="sr-only">Open</span></button>{{/if}}

Diff for: test/markup/tree-markup.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<label class="control-label">Items selectable only</label>
77
<div class="form-group">
88

9-
<ul class="tree" id="MyTree" role="tree" aria-activedescendant="">
9+
<ul class="tree" id="MyTree" role="tree" aria-activedescendant="" aria-label="My Tree">
1010
<li class="tree-branch hidden" data-template="treebranch" role="treeitem" aria-expanded="false">
1111
<div class="tree-branch-header">
1212
<button type="button" class="tree-branch-name" tabindex="-1">
@@ -33,7 +33,7 @@
3333
<li class="tree-loader hidden"><span role="alert">Loading...</span></li>
3434
</ul>
3535

36-
<ul class="tree" id="MyTree2" role="tree" aria-activedescendant="">
36+
<ul class="tree" id="MyTree2" role="tree" aria-activedescendant="" aria-label="My Tree 2">
3737
<li class="tree-branch hidden" data-template="treebranch" role="treeitem" aria-expanded="false">
3838
<div class="tree-branch-header">
3939
<button type="button" class="tree-branch-name" tabindex="-1">
@@ -67,7 +67,7 @@
6767
<label class="control-label">Folders selectable</label>
6868
<div class="form-group">
6969

70-
<ul id="MyTreeSelectableFolder" class="tree tree-folder-select" role="tree" aria-activedescendant="">
70+
<ul id="MyTreeSelectableFolder" class="tree tree-folder-select" role="tree" aria-activedescendant="" aria-label="My Tree Selectable">
7171
<li class="tree-branch hidden" data-template="treebranch" role="treeitem" aria-expanded="false">
7272
<div class="tree-branch-header">
7373
<button type="button" class="tree-branch-name" tabindex="-1">

0 commit comments

Comments
 (0)