diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-06-03 17:51:33 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-06-03 17:51:33 +0200 |
commit | 4984078a56771a4f1be9af69eaedf8faefc2019b (patch) | |
tree | db7a95407bd419fea5105e0c6f5dc23c1cdaf651 /program | |
parent | 458af8d30a1bca153f770358b8f914554b0da6c3 (diff) |
Fix list keyboard navigation with toggleselect on
Diffstat (limited to 'program')
-rw-r--r-- | program/js/list.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/program/js/list.js b/program/js/list.js index b9a437c26..33693abd8 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -95,6 +95,12 @@ init: function() this.tbody = this.list; } + if ($(this.list).attr('role') == 'listbox') { + this.aria_listbox = true; + if (this.multiselect) + $(this.list).attr('aria-multiselectable', 'true'); + } + if (this.tbody) { this.rows = {}; this.rowcount = 0; @@ -118,12 +124,6 @@ init: function() } } - if ($(this.list).attr('role') == 'listbox') { - this.aria_listbox = true; - if (this.multiselect) - $(this.list).attr('aria-multiselectable', 'true'); - } - return this; }, @@ -897,9 +897,10 @@ get_cell: function(row, index) */ select_row: function(id, mod_key, with_mouse) { - var select_before = this.selection.join(','); + var select_before = this.selection.join(','), + in_selection_before = this.in_selection(id); - if (!this.multiselect) + if (!this.multiselect && with_mouse) mod_key = 0; if (!this.shift_start) @@ -935,21 +936,21 @@ select_row: function(id, mod_key, with_mouse) this.multi_selecting = true; } - // trigger event if selection changed - if (this.selection.join(',') != select_before) - this.triggerEvent('select'); - if (this.last_selected != 0 && this.rows[this.last_selected]) { $(this.rows[this.last_selected].obj).removeClass('focused') .find(this.col_tagname()).eq(this.subject_col).removeAttr('tabindex'); } // unselect if toggleselect is active and the same row was clicked again - if (this.toggleselect && this.last_selected == id) { + if (this.toggleselect && in_selection_before) { this.clear_selection(); - id = null; } - else { + // trigger event if selection changed + else if (this.selection.join(',') != select_before) { + this.triggerEvent('select'); + } + + if (this.rows[id]) { $(this.rows[id].obj).addClass('focused'); // set cursor focus to link inside selected row if (this.focused) |