[Svn] r1674 - trunk/roundcubemail/program/js

trac at roundcube.net trac at roundcube.net
Fri Aug 22 12:37:48 CEST 2008


Author: thomasb
Date: 2008-08-22 10:37:48 +0000 (Fri, 22 Aug 2008)
New Revision: 1674

Modified:
   trunk/roundcubemail/program/js/app.js
   trunk/roundcubemail/program/js/list.js
Log:
Fix keyboard control of the list widgets and prevent Safari from scrolling (#1485279)

Modified: trunk/roundcubemail/program/js/app.js
===================================================================
--- trunk/roundcubemail/program/js/app.js	2008-08-22 09:58:48 UTC (rev 1673)
+++ trunk/roundcubemail/program/js/app.js	2008-08-22 10:37:48 UTC (rev 1674)
@@ -1189,7 +1189,7 @@
 
     // 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 @@
 
       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);
 

Modified: trunk/roundcubemail/program/js/list.js
===================================================================
--- trunk/roundcubemail/program/js/list.js	2008-08-22 09:58:48 UTC (rev 1673)
+++ trunk/roundcubemail/program/js/list.js	2008-08-22 10:37:48 UTC (rev 1674)
@@ -86,8 +86,10 @@
     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 @@
  */
 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;

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list