Bug 1702027 - Prevent blurring the current element and focusing on a new Tab if it was opened in the background. r=darktrojan

Differential Revision: https://phabricator.services.mozilla.com/D110327

--HG--
extra : amend_source : 6fb88d0980135eae48efae3893772ff0f712a5cf
This commit is contained in:
Alessandro Castellani 2021-03-31 12:38:39 +03:00
Родитель 297eaef880
Коммит 06250493d4
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -957,7 +957,9 @@
let oldPanel = [...this.panelContainer.children].find(p =>
p.hasAttribute("selected")
);
if (oldPanel) {
// Blur the currently focused element only if we're actually switching
// to the newly opened tab.
if (oldPanel && !background) {
// Remember what has focus for when we return to this tab.
if (
oldPanel.compareDocumentPosition(document.activeElement) &
@ -1029,20 +1031,18 @@
// openTab.
this._mostRecentTabInfo = null;
t.setAttribute("label", tab.title);
// For styling purposes, apply the type to the tab.
t.setAttribute("type", tab.mode.type);
if (!background) {
this.setDocumentTitle(tab);
}
// for styling purposes, apply the type to the tab...
t.setAttribute("type", tab.mode.type);
if (!background) {
// Update the toolbar status - we don't need to do menus as they
// do themselves when we open them.
UpdateMailToolbar("tabmail");
// Move the focus on the newly selected tab.
this.panelContainer.selectedPanel.focus();
}
this.panelContainer.selectedPanel.focus();
let moving = restoreState ? restoreState.moving : null;
// Dispatch tab opening event
let evt = new CustomEvent("TabOpen", {