diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-05-27 19:22:11 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-05-27 19:22:11 +0200 |
commit | d0d7f43ef53d71322a8793ec10f7179f30615127 (patch) | |
tree | 9b6c9f546f29e3d94ab768fa5cfef2ba9513d84c /program/js/app.js | |
parent | 1791a1e7a23c0aaf126ba099a73564e8c4e88cee (diff) |
More aria-* improvements to toggle buttons and autocompletion lists
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/program/js/app.js b/program/js/app.js index 658f3c569..41f9a3859 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4522,11 +4522,11 @@ function rcube_webmail() this.ksearch_select = function(node) { if (this.ksearch_pane && node) { - this.ksearch_pane.find('li.selected').removeClass('selected'); + this.ksearch_pane.find('li.selected').removeClass('selected').removeAttr('aria-selected'); } if (node) { - $(node).addClass('selected'); + $(node).addClass('selected').removeAttr('aria-selected', 'true'); this.ksearch_selected = node._rcm_id; $(this.ksearch_input).attr('aria-activedecendant', 'rcmkSearchItem' + this.ksearch_selected); } @@ -4659,7 +4659,7 @@ function rcube_webmail() return; // display search results - var i, len, ul, li, text, type, init, + var i, id, len, ul, text, type, init, value = this.ksearch_value, maxlen = this.env.autocomplete_max ? this.env.autocomplete_max : 15; @@ -4697,12 +4697,13 @@ function rcube_webmail() for (i=0; i < len && maxlen > 0; i++) { text = typeof results[i] === 'object' ? results[i].name : results[i]; type = typeof results[i] === 'object' ? results[i].type : ''; - li = document.createElement('LI'); - li._rcm_id = i + this.env.contacts.length; - li.id = 'rcmkSearchItem' + li._rcm_id; - li.innerHTML = this.quote_html(text.replace(new RegExp('('+RegExp.escape(value)+')', 'ig'), '##$1%%')).replace(/##([^%]+)%%/g, '<b>$1</b>'); - if (type) li.className = type; - ul.appendChild(li); + id = i + this.env.contacts.length; + $('<li>').attr('id', 'rcmkSearchItem' + id) + .attr('role', 'option') + .html(this.quote_html(text.replace(new RegExp('('+RegExp.escape(value)+')', 'ig'), '##$1%%')).replace(/##([^%]+)%%/g, '<b>$1</b>')) + .addClass(type || '') + .appendTo(ul) + .get(0)._rcm_id = id; maxlen -= 1; } } |