diff --git a/suite/browser/navigator.js b/suite/browser/navigator.js index 9c612057042e..ac6e49b7b637 100644 --- a/suite/browser/navigator.js +++ b/suite/browser/navigator.js @@ -675,9 +675,13 @@ function WindowFocusTimerCallback(element) // set the element in command dispatcher so focus will restore properly // when the window does become active - document.commandDispatcher.focusedWindow = window; - if (element instanceof Components.interfaces.nsIDOMElement) + if (element instanceof Components.interfaces.nsIDOMWindow) { + document.commandDispatcher.focusedWindow = element; + document.commandDispatcher.focusedElement = null; + } else if (element instanceof Components.interfaces.nsIDOMElement) { + document.commandDispatcher.focusedWindow = element.ownerDocument.defaultView; document.commandDispatcher.focusedElement = element; + } } }