summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-05-07 20:04:13 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-05-07 20:04:13 +0200
commitea0866a1adc9239b8b115ab2490e1dd88f3c64ec (patch)
tree36ea1a79e319a49df5e224e1b79736b5984c6c2a /program
parentb2992dd2283c3d0ac95f3293497dfaed0493f607 (diff)
Improve keyboard navigation on compose screen: define tabindex groups + enable keyboard controls of contacts list widget
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail_output_html.php2
-rw-r--r--program/js/app.js31
-rw-r--r--program/js/list.js2
3 files changed, 23 insertions, 12 deletions
diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php
index ff660a4df..19a8d142c 100644
--- a/program/include/rcmail_output_html.php
+++ b/program/include/rcmail_output_html.php
@@ -1135,6 +1135,8 @@ EOF;
$attrib['role'] = 'button';
}
if (!empty($attrib['class']) && !empty($attrib['classact']) || !empty($attrib['imagepas']) && !empty($attrib['imageact'])) {
+ if (array_key_exists('tabindex', $attrib))
+ $attrib['data-tabindex'] = $attrib['tabindex'];
$attrib['tabindex'] = '-1'; // disable button by default
$attrib['aria-disabled'] = 'true';
}
diff --git a/program/js/app.js b/program/js/app.js
index 11236d0cb..4c9462afa 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -300,10 +300,12 @@ function rcube_webmail()
$('a.insertresponse', this.gui_objects.responseslist)
.attr('unselectable', 'on')
.mousedown(function(e){ return rcube_event.cancel(e); })
- .mouseup(function(e){
- ref.command('insert-response', $(this).attr('rel'));
- $(document.body).trigger('mouseup'); // hides the menu
- return rcube_event.cancel(e);
+ .bind('mouseup keypress', function(e){
+ if (e.type == 'mouseup' || rcube_event.get_keycode(e) == 13) {
+ ref.command('insert-response', $(this).attr('rel'));
+ $(document.body).trigger('mouseup'); // hides the menu
+ return rcube_event.cancel(e);
+ }
});
// avoid textarea loosing focus when hitting the save-response button/link
@@ -337,11 +339,12 @@ function rcube_webmail()
// init address book widget
if (this.gui_objects.contactslist) {
this.contact_list = new rcube_list_widget(this.gui_objects.contactslist,
- { multiselect:true, draggable:false, keyboard:false });
+ { multiselect:true, draggable:false, keyboard:true });
this.contact_list
.addEventListener('initrow', function(o) { ref.triggerEvent('insertrow', { cid:o.uid, row:o }); })
.addEventListener('select', function(o) { ref.compose_recipient_select(o); })
.addEventListener('dblclick', function(o) { ref.compose_add_recipient('to'); })
+ .addEventListener('keypress', function(o) { if (o.key_pressed == o.ENTER_KEY) ref.compose_add_recipient('to'); })
.init();
}
@@ -3600,10 +3603,12 @@ function rcube_webmail()
.mousedown(function(e){
return rcube_event.cancel(e);
})
- .mouseup(function(e){
- ref.command('insert-response', key);
- $(document.body).trigger('mouseup'); // hides the menu
- return rcube_event.cancel(e);
+ .bind('mouseup keypress', function(e){
+ if (e.type == 'mouseup' || rcube_event.get_keycode(e) == 13) {
+ ref.command('insert-response', $(this).attr('rel'));
+ $(document.body).trigger('mouseup'); // hides the menu
+ return rcube_event.cancel(e);
+ }
});
}
};
@@ -6195,7 +6200,7 @@ function rcube_webmail()
// set button to a specific state
this.set_button = function(command, state)
{
- var n, button, obj, a_buttons = this.buttons[command],
+ var n, button, obj, $obj, a_buttons = this.buttons[command],
len = a_buttons ? a_buttons.length : 0;
for (n=0; n<len; n++) {
@@ -6235,8 +6240,9 @@ function rcube_webmail()
$(obj).button('option', 'disabled', state == 'pas');
}
else {
- $(obj)
- .attr('tabindex', state == 'pas' || state == 'sel' ? '-1' : '0')
+ $obj = $(obj);
+ $obj
+ .attr('tabindex', state == 'pas' || state == 'sel' ? '-1' : ($obj.attr('data-tabindex') || '0'))
.attr('aria-disabled', state == 'pas' || state == 'sel' ? 'true' : 'false');
}
}
@@ -7147,6 +7153,7 @@ function rcube_webmail()
this.enable_command('search-create', this.env.source == '');
this.enable_command('search-delete', this.env.search_id);
this.update_group_commands();
+ this.contact_list.focus();
this.triggerEvent('listupdate', { folder:this.env.source, rowcount:this.contact_list.rowcount });
}
}
diff --git a/program/js/list.js b/program/js/list.js
index 14dfde379..6a0c5b3b6 100644
--- a/program/js/list.js
+++ b/program/js/list.js
@@ -558,6 +558,8 @@ click_row: function(e, id)
}
this.rows[id].clicked = now;
+ this.focus();
+
return false;
},