Bind mousedown to _selectPassword instead of click.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 23 Feb 2014 03:55:17 +0000 (22:55 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 23 Feb 2014 03:55:17 +0000 (22:55 -0500)
Event click is dispatched from touch events as well as mouse events, but
the selection behavior only makes sense with pointing devices.

core.js

diff --git a/core.js b/core.js
index 189b08277d92b7b30042eebc0a1f11798b5da03b..747968e44c4da9294c9d87d80ccf7dc426178c4e 100644 (file)
--- a/core.js
+++ b/core.js
@@ -69,8 +69,15 @@ SkeletonKey.prototype._init = function() {
   this._sitekey.onkeyup = this._nextFieldInterceptor.bind(this);
   this._username.onkeyup = this._nextFieldInterceptor.bind(this);
 
-  this._password.onclick = this._selectPassword.bind(this);
-  this._password.labels[0].onclick = this._selectPassword.bind(this);
+  this._password.onmousedown = this._selectPassword.bind(this);
+  this._password.labels[0].onmousedown = this._selectPassword.bind(this);
+
+  function eatEvent(e) {
+    e.stopPropagation();
+    e.preventDefault();
+  }
+  this._password.onmouseup = eatEvent;
+  this._password.labels[0].onmouseup = eatEvent;
 
   if (this._isChromeExtension()) {
     this._initChromeExtension();