From 3412e50b54e3daac8745234e21ab6e72be0ed165 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Wed, 04 Jun 2014 11:20:33 -0400 Subject: [PATCH] Fix attachment menu structure and aria-attributes --- program/js/app.js | 44 +++++++++++++++++++------------------------- 1 files changed, 19 insertions(+), 25 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index ea7265d..b1feeb4 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3439,9 +3439,7 @@ this.env.recipients_delimiter = this.env.recipients_separator + ' '; obj.keydown(function(e) { return ref.ksearch_keydown(e, this, props); }) - .attr('autocomplete', 'off') - .attr('aria-autocomplete', 'list') - .attr('aria-expanded', 'false'); + .attr({ 'autocomplete': 'off', 'aria-autocomplete': 'list', 'aria-expanded': 'false', 'role': 'combobox' }); }; this.submit_messageform = function(draft) @@ -4586,9 +4584,9 @@ } if (node) { - $(node).addClass('selected').removeAttr('aria-selected', 'true'); + $(node).addClass('selected').attr('aria-selected', 'true'); this.ksearch_selected = node._rcm_id; - $(this.ksearch_input).attr('aria-activedecendant', 'rcmkSearchItem' + this.ksearch_selected); + $(this.ksearch_input).attr('aria-activedescendant', 'rcmkSearchItem' + this.ksearch_selected); } }; @@ -4769,17 +4767,18 @@ } if (ul.childNodes.length) { - this.ksearch_pane.show(); - // select the first - if (!this.env.contacts.length) { - this.ksearch_select($('li:first', ul).get(0)); - } - // set the right aria-* attributes to the input field $(this.ksearch_input) .attr('aria-haspopup', 'true') .attr('aria-expanded', 'true') - .attr('aria-owns', 'rcmKSearchpane') + .attr('aria-owns', 'rcmKSearchpane'); + + this.ksearch_pane.show(); + + // select the first + if (!this.env.contacts.length) { + this.ksearch_select($('li:first', ul).get(0)); + } } if (len) @@ -4818,7 +4817,7 @@ $(this.ksearch_input) .attr('aria-haspopup', 'false') .attr('aria-expanded', 'false') - .removeAttr('aria-activedecendant') + .removeAttr('aria-activedescendant') .removeAttr('aria-owns'); this.ksearch_destroy(); @@ -5562,6 +5561,7 @@ if (appendcontainer.length && appendcontainer.get(0).nodeName == 'FIELDSET') { var input, colprop = this.env.coltypes[col], + input_id = 'ff_' + col + (colprop.count || 0), row = $('<div>').addClass('row'), cell = $('<div>').addClass('contactfieldcontent data'), label = $('<div>').addClass('contactfieldlabel label'); @@ -5569,13 +5569,13 @@ if (colprop.subtypes_select) label.html(colprop.subtypes_select); else - label.html(colprop.label); + label.html('<label for="' + input_id + '">' + colprop.label + '</label>'); var name_suffix = colprop.limit != 1 ? '[]' : ''; if (colprop.type == 'text' || colprop.type == 'date') { input = $('<input>') .addClass('ff_'+col) - .attr({type: 'text', name: '_'+col+name_suffix, size: colprop.size}) + .attr({type: 'text', name: '_'+col+name_suffix, size: colprop.size, id: input_id}) .appendTo(cell); this.init_edit_field(col, input); @@ -5586,7 +5586,7 @@ else if (colprop.type == 'textarea') { input = $('<textarea>') .addClass('ff_'+col) - .attr({ name: '_'+col+name_suffix, cols:colprop.size, rows:colprop.rows }) + .attr({ name: '_'+col+name_suffix, cols:colprop.size, rows:colprop.rows, id: input_id }) .appendTo(cell); this.init_edit_field(col, input); @@ -5621,7 +5621,7 @@ else if (colprop.type == 'select') { input = $('<select>') .addClass('ff_'+col) - .attr('name', '_'+col+name_suffix) + .attr({ 'name': '_'+col+name_suffix, id: input_id }) .appendTo(cell); var options = input.attr('options'); @@ -6711,7 +6711,7 @@ tr = document.createElement('tr'); for (c=0, len=repl.length; c < len; c++) { - cell = document.createElement('td'); + cell = document.createElement('th'); cell.innerHTML = repl[c].html || ''; if (repl[c].id) cell.id = repl[c].id; if (repl[c].className) cell.className = repl[c].className; @@ -6953,13 +6953,7 @@ container.data('callback')($(this).data('id')); return false; }); -/* - // hide selector on click out of selector element - var fn = function(e) { if (e.target != container.get(0)) container.hide(); }; - $(document.body).on('mouseup', fn); - $('iframe').contents().on('mouseup', fn) - .load(function(e) { try { $(this).contents().on('mouseup', fn); } catch(e) {}; }); -*/ + this.folder_selector_element = container; } -- Gitblit v1.9.1