diff --git a/common/content/commandline.js b/common/content/commandline.js index ceaab95d..3cf54785 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -623,10 +623,8 @@ var CommandLine = Module("commandline", { this.widgets.message = null; if (modes.main != modes.COMMAND_LINE) this.widgets.command = null; - if (modes.main == modes.OUTPUT_MULTILINE && this.widgets.multilineOutput.atEnd) { - dactyl.focusContent(); + if (modes.main == modes.OUTPUT_MULTILINE && this.widgets.multilineOutput.atEnd) modes.pop(); - } if (modes.main != modes.OUTPUT_MULTILINE) this.multilineOutputVisible = false; }, diff --git a/common/content/events.js b/common/content/events.js index 666df991..0c3b5a7a 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -93,6 +93,7 @@ var Events = Module("events", { this._activeMenubar = false; this.addSessionListener(window, "DOMMenuBarActive", this.onDOMMenuBarActive, true); this.addSessionListener(window, "DOMMenuBarInactive", this.onDOMMenuBarInactive, true); + this.addSessionListener(window, "blur", this.onBlur, true); this.addSessionListener(window, "focus", this.onFocus, true); this.addSessionListener(window, "keydown", this.onKeyUpOrDown, true); this.addSessionListener(window, "keypress", this.onKeyPress, true); @@ -724,6 +725,15 @@ var Events = Module("events", { } }, + onBlur: function onFocus(event) { + if (event.originalTarget instanceof Window && services.focus.activeWindow == null) + // Deals with circumstances where, after the main window + // blurs while a collapsed frame has focus, re-activating + // the main window does not restore focus and we lose key + // input. + services.focus.clearFocus(window); + }, + // TODO: Merge with onFocusChange onFocus: function onFocus(event) { let elem = event.originalTarget;