Bug 1272179 - reset focus whenever the sidebar is hidden. r=bgrins

MozReview-Commit-ID: FxnbMyEuTzw

--HG--
extra : rebase_source : c736bf92cc87cf160cdb97f81e46a605bf695ef4
This commit is contained in:
Yura Zenevich 2016-05-12 11:24:58 -04:00
parent 8c3ca46ed3
commit b9f4e16eb6
2 changed files with 6 additions and 0 deletions

View File

@ -496,6 +496,7 @@ ToolSidebar.prototype = {
hide: function() {
Services.prefs.setIntPref("devtools.toolsidebar-width." + this._uid, this._tabbox.width);
this._tabbox.setAttribute("hidden", "true");
this._panelDoc.activeElement.blur();
this.emit("hide");
},

View File

@ -118,7 +118,12 @@ function test() {
ok(true, "received 'unselected' event");
panel.sidebar.once("tab2-selected", function() {
ok(true, "received 'selected' event");
tabs[1].focus();
is(panel.sidebar._panelDoc.activeElement, tabs[1],
"Focus is set to second tab");
panel.sidebar.hide();
isnot(panel.sidebar._panelDoc.activeElement, tabs[1],
"Focus is reset for sidebar");
is(panel.sidebar._tabbox.getAttribute("hidden"), "true", "Sidebar hidden");
is(panel.sidebar.getWindowForTab("tab1").location.href, tab1URL, "Window is accessible");
testRemoval(panel);