From 88fd87f36372125ab88f1739a890580c5d98f18f Mon Sep 17 00:00:00 2001 From: Asaf Romano Date: Tue, 5 Feb 2013 15:56:35 +0100 Subject: [PATCH] Bug 836211 - Give focus to the downloads view if the previous view had focus. r=mak --- browser/components/places/content/places.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/browser/components/places/content/places.js b/browser/components/places/content/places.js index 9ce3fd00318a..191971368541 100644 --- a/browser/components/places/content/places.js +++ b/browser/components/places/content/places.js @@ -1251,10 +1251,17 @@ let ContentArea = { }, get currentView() PlacesUIUtils.getViewForNode(this._deck.selectedPanel), - set currentView(aView) { - if (this.currentView != aView) - this._deck.selectedPanel = aView.associatedElement; - return aView; + set currentView(aNewView) { + let oldView = this.currentView; + if (oldView != aNewView) { + this._deck.selectedPanel = aNewView.associatedElement; + + // If the content area inactivated view was focused, move focus + // to the new view. + if (document.activeElement == oldView.associatedElement) + aNewView.associatedElement.focus(); + } + return aNewView; }, get currentPlace() this.currentView.place,