changeset 33:8d34fb3e9108

Fixed a problem Myk reported whereby if you have Firefox's 'Search for text when I start typing' preference enabled, your keystrokes after your first one can't get to WebGnusto.
author Atul Varma <varmaa@toolness.com>
date Tue, 13 May 2008 16:53:24 -0700
parents 3a85b5915ea6
children cf2303c41d8c
files trivial-zui.js
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/trivial-zui.js	Mon May 12 11:23:47 2008 -0700
+++ b/trivial-zui.js	Tue May 13 16:53:24 2008 -0700
@@ -37,7 +37,7 @@
                         callback(keyCode);
                     }
                 }
-                return;
+                return false;
             }
 
             var oldInputString = self._inputString;
@@ -123,6 +123,18 @@
     };
 
     $(window).keypress(self._windowKeypress);
+
+    // We want to make sure that all key events don't bubble up, so
+    // that anything listening in--such as Firefox's "Search for text
+    // when I start typing" feature--doesn't think that we're not
+    // doing anything with the keypresses.  If we don't do this, such
+    // listeners may think that they can intervene and capture
+    // keystrokes before they get to us in the future.
+
+    var suppressionFunc = function(evt) { return false; };
+
+    $(window).keyup(suppressionFunc);
+    $(window).keydown(suppressionFunc);
 }
 
 $(document).ready( function() {