summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-06-02 18:43:21 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-06-02 18:43:21 +0200
commit4582bff0635495740022543320fc7c77b0362fc4 (patch)
tree79ce452f7395511050ecfecf33fe1a7d574df4ae /program/js
parentd58c39126f6e1754e29b6f3bbc01f0f6a3ea2581 (diff)
Add aria-* controls to turn tables into a listbox widget
Diffstat (limited to 'program/js')
-rw-r--r--program/js/list.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/program/js/list.js b/program/js/list.js
index 65d4a9260..b9a437c26 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -60,6 +60,7 @@ function rcube_list_widget(list, p)
this.column_movable = false;
this.keyboard = false;
this.toggleselect = false;
+ this.aria_listbox = false;
this.drag_active = false;
this.col_drag_active = false;
@@ -117,6 +118,12 @@ init: function()
}
}
+ if ($(this.list).attr('role') == 'listbox') {
+ this.aria_listbox = true;
+ if (this.multiselect)
+ $(this.list).attr('aria-multiselectable', 'true');
+ }
+
return this;
},
@@ -159,6 +166,15 @@ init_row: function(row)
}, false);
}
+ // label the list row with the subject col as descriptive label
+ if (this.aria_listbox) {
+ var lbl_id = 'l:' + row.id;
+ $(row)
+ .attr('role', 'option')
+ .attr('aria-labelledby', lbl_id)
+ .find(this.col_tagname()).eq(this.subject_col).attr('id', lbl_id);
+ }
+
if (document.all)
row.onselectstart = function() { return false; };