From c10e05bbe42be3237db4dc0e350856cc95fad543 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 22 Jan 2011 10:12:44 -0500 Subject: [PATCH] Go to irritating lengths to keep the hidden location bar from stealing keyboard focus. Closes issue #292. --- common/content/dactyl.js | 2 +- common/content/events.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 08a717f2..675f4337 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1245,7 +1245,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { if (error.result == Cr.NS_BINDING_ABORTED) return; if (echo) - dactyl.echoerr(error); + dactyl.echoerr(error, commandline.FORCE_SINGLELINE); util.reportError(error); }, diff --git a/common/content/events.js b/common/content/events.js index a2d079ca..3194743c 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -143,9 +143,10 @@ var Events = Module("events", { catch (e) { dactyl.reportError(e); if (e.message == "Interrupted") - dactyl.echoerr("Interrupted"); + dactyl.echoerr("Interrupted", commandline.FORCE_SINGLELINE); else - dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e)); + dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e), + commandline.FORCE_SINGLELINE); } }; return wrappedListener; @@ -739,6 +740,13 @@ var Events = Module("events", { if (elem instanceof Element) { let win = elem.ownerDocument.defaultView; + if (event.target instanceof Ci.nsIDOMXULTextBoxElement) + for (let e = elem; e; e = e.parentNode) + if (util.computedStyle(e).visibility !== "visible") { + elem.blur(); + break; + } + if (events.isContentNode(elem) && !buffer.focusAllowed(elem) && !(services.focus.getLastFocusMethod(win) & 0x7000) && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {