From c5e18a465a7251a53acbd1d414aec3f26708bada Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Sat, 5 May 2012 01:32:34 +0200 Subject: [PATCH 1/2] Bug 743877 - tab switching shouldn't occur off a timeout; r=gavin --- toolkit/content/widgets/tabbox.xml | 14 +++++++------- toolkit/content/xul.css | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/toolkit/content/widgets/tabbox.xml b/toolkit/content/widgets/tabbox.xml index 40ea9e4a6dc..98f87ec239b 100644 --- a/toolkit/content/widgets/tabbox.xml +++ b/toolkit/content/widgets/tabbox.xml @@ -791,13 +791,13 @@ return; if (this != this.parentNode.selectedItem) { // Not selected yet - // Select new tab after short delay so that PostHandleEvent() doesn't see - // the tab as selected yet, otherwise it will focus the tab for us -- - // the CSS for tab has -moz-user-focus: normal only for selected="true". - function setTab(tab) { - tab.parentNode._selectNewTab(tab); - } - setTimeout(setTab, 0, this); + // Set '-moz-user-focus' to 'ignore' so that PostHandleEvent() doesn't + // see the tab as selected yet, otherwise it will focus the tab for us. + // After a short timeout we'll reset '-moz-user-focus' so that tabs + // can be selected by keyboard again. + this.setAttribute("ignorefocus", "true"); + this.parentNode._selectNewTab(this); + setTimeout(function (tab) tab.removeAttribute("ignorefocus"), 0, this); } // Otherwise this tab is already selected and we will fall // through to mousedown behavior which sets focus on the current tab, diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index 860007c3980..01f6923a73b 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -652,7 +652,7 @@ tab { -moz-box-pack: center; } -tab[selected="true"] { +tab[selected="true"]:not([ignorefocus="true"]) { -moz-user-focus: normal; } From 600588d2350c9a9e84abe330a3e7d2fd048809f6 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Sat, 5 May 2012 06:38:23 +0200 Subject: [PATCH 2/2] Backed out changeset c11d28e40534 (bug 743877) --- toolkit/content/widgets/tabbox.xml | 14 +++++++------- toolkit/content/xul.css | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/toolkit/content/widgets/tabbox.xml b/toolkit/content/widgets/tabbox.xml index 98f87ec239b..40ea9e4a6dc 100644 --- a/toolkit/content/widgets/tabbox.xml +++ b/toolkit/content/widgets/tabbox.xml @@ -791,13 +791,13 @@ return; if (this != this.parentNode.selectedItem) { // Not selected yet - // Set '-moz-user-focus' to 'ignore' so that PostHandleEvent() doesn't - // see the tab as selected yet, otherwise it will focus the tab for us. - // After a short timeout we'll reset '-moz-user-focus' so that tabs - // can be selected by keyboard again. - this.setAttribute("ignorefocus", "true"); - this.parentNode._selectNewTab(this); - setTimeout(function (tab) tab.removeAttribute("ignorefocus"), 0, this); + // Select new tab after short delay so that PostHandleEvent() doesn't see + // the tab as selected yet, otherwise it will focus the tab for us -- + // the CSS for tab has -moz-user-focus: normal only for selected="true". + function setTab(tab) { + tab.parentNode._selectNewTab(tab); + } + setTimeout(setTab, 0, this); } // Otherwise this tab is already selected and we will fall // through to mousedown behavior which sets focus on the current tab, diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index 01f6923a73b..860007c3980 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -652,7 +652,7 @@ tab { -moz-box-pack: center; } -tab[selected="true"]:not([ignorefocus="true"]) { +tab[selected="true"] { -moz-user-focus: normal; }