diff options
author | thomascube <thomas@roundcube.net> | 2008-08-22 10:37:48 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-08-22 10:37:48 +0000 |
commit | 26f5b0935ef4d8bc01e2b8581f7d7ed3c4508fc2 (patch) | |
tree | 2c5c1388631779ec04234200532aed74bc1b5775 /program/js | |
parent | 0ced2b9ac03e425750a76dea3ed59156b2709b4c (diff) |
Fix keyboard control of the list widgets and prevent Safari from scrolling (#1485279)
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 4 | ||||
-rw-r--r-- | program/js/list.js | 18 |
2 files changed, 12 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js index df2c8399a..b5073daed 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1189,7 +1189,7 @@ function rcube_webmail() // start timer for message preview (wait for double click) if (selected && this.env.contentframe && !list.multi_selecting) - this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, this.dblclick_time + 10); + this.preview_timer = window.setTimeout(function(){ ref.msglist_get_preview(); }, 200); else if (this.env.contentframe) this.show_contentframe(false); }; @@ -2460,7 +2460,7 @@ function rcube_webmail() var id, frame, ref = this; if (id = list.get_single_selection()) - this.preview_timer = window.setTimeout(function(){ ref.load_contact(id, 'show'); }, this.dblclick_time + 10); + this.preview_timer = window.setTimeout(function(){ ref.load_contact(id, 'show'); }, 200); else if (this.env.contentframe) this.show_contentframe(false); diff --git a/program/js/list.js b/program/js/list.js index a163f55ba..a83a8af6f 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -86,8 +86,10 @@ init: function() this.frame = this.list.parentNode; // set body events - if (this.keyboard) - rcube_event.add_listener({element:document, event:'keypress', object:this, method:'key_press'}); + if (this.keyboard) { + rcube_event.add_listener({element:document, event:'keyup', object:this, method:'key_press'}); + rcube_event.add_listener({element:document, event:'keydown', object:rcube_event, method:'cancel'}); + } } }, @@ -548,20 +550,20 @@ highlight_row: function(id, multiple) */ key_press: function(e) { - if (this.focused != true) + if (this.focused != true) return true; - var keyCode = document.layers ? e.which : document.all ? event.keyCode : document.getElementById ? e.keyCode : 0; + var keyCode = rcube_event.get_keycode(e); var mod_key = rcube_event.get_modifier(e); switch (keyCode) { case 40: case 38: - case 63233: // "down", in safari keypress - case 63232: // "up", in safari keypress + case 63233: // "down", in safari keypress + case 63232: // "up", in safari keypress + // Stop propagation so that the browser doesn't scroll + rcube_event.cancel(e); return this.use_arrow_key(keyCode, mod_key); - break; - default: this.shiftkey = e.shiftKey; this.key_pressed = keyCode; |