From d4d62ac414a3ba706fb65c581581c419a90d5ac9 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 27 May 2014 16:59:28 +0200 Subject: [PATCH] Set aria-* attributes for autocompletion fields and widgets --- program/js/app.js | 42 +++++++++++++++++++++++++++++------------- program/js/list.js | 1 + 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 06008b2da..4bd6442b3 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3381,7 +3381,9 @@ function rcube_webmail() this.env.recipients_delimiter = this.env.recipients_separator + ' '; obj.keydown(function(e) { return ref.ksearch_keydown(e, this, props); }) - .attr('autocomplete', 'off'); + .attr('autocomplete', 'off') + .attr('aria-autocomplete', 'list') + .attr('aria-expanded', 'false'); }; this.submit_messageform = function(draft) @@ -4471,7 +4473,7 @@ function rcube_webmail() var dir = key==38 ? 1 : 0; - highlight = document.getElementById('rcmksearchSelected'); + highlight = document.getElementById('rcmkSearchItem' + this.ksearch_selected); if (!highlight) highlight = this.ksearch_pane.__ul.firstChild; @@ -4519,14 +4521,14 @@ function rcube_webmail() this.ksearch_select = function(node) { - var current = $('#rcmksearchSelected'); - if (current[0] && node) { - current.removeAttr('id').removeClass('selected'); + if (this.ksearch_pane && node) { + this.ksearch_pane.find('li.selected').removeClass('selected'); } if (node) { - $(node).attr('id', 'rcmksearchSelected').addClass('selected'); + $(node).addClass('selected'); this.ksearch_selected = node._rcm_id; + $(this.ksearch_input).attr('aria-activedecendant', 'rcmkSearchItem' + this.ksearch_selected); } }; @@ -4664,9 +4666,13 @@ function rcube_webmail() // create results pane if not present if (!this.ksearch_pane) { ul = $('