Page MenuHomePhabricator

Reproducible FOUC on Search and ISBN Lookup (CSS delayed in Firefox)
Closed, ResolvedPublic


There are reports on de.wikipedia that in Firefox (and perhaps also other browsers, but less frequent) the stylesheets are sometimes loaded too late. This happens both in Firefox 57 and in previous versions.
I can reliably reproduce this on Special:Search (in any WMF wiki, including beta.wmflabs), both logged in and out, with cache and uncached, so this doesn't seem to be some intermittent network issue.
Every time I load or reload or similar, I briefly see the page rendered without CSS (every time in Firefox ESR; with Firefox 57 it still happens very often, but not every time).
Though according to the reports other pages are affected as well, I can only reproduce on Special:Search, but as said, there it fails reliably.


Pages with an autofocus input field render in Firefox without waiting for stylesheets to apply. This is mainly observed on three special pages:

See also: T188954: FOUC on Flow deletion form in Firefox

=> Upstream:

Update as of 14 February 2018: The bug has been fixed in Firefox Nightly. The solution is expected to be part of Firefox 60, (release notes), which will be Beta starting March 12, and will be released to stable starting May 8. (release schedule)

Event Timeline

Schnark created this task.Dec 2 2017, 8:26 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 2 2017, 8:26 AM
Aklapper renamed this task from CSS sometimes delayed in Firefox to CSS loading sometimes delayed in Firefox; FOUC reproducibly displayed.Dec 2 2017, 1:35 PM
Restricted Application added a project: Performance-Team. · View Herald TranscriptDec 2 2017, 1:35 PM
Aklapper edited projects, added Regression; removed Performance-Team.EditedDec 2 2017, 1:35 PM

Thanks for reporting this. Confirming on on Firefox 56

I'm using FF ESR 52.4.0 64-bit with dewiki and enwiki and can ''not'' confirm that behavior. Maybe it is caused by some JavaScript (I have that disabled using the NoScript extension) or by some FF extension ?

Report upstream to Mozilla

Imarlier assigned this task to Krinkle.Dec 4 2017, 9:03 PM
Imarlier moved this task from Inbox to Doing on the Performance-Team board.

I am able to consistently reproduce this at in Firefox 57 on Mac, as well as in the Developer Edition. On reloads it only happens when I throttle the network speed to no more than "Good 3G".

I used ?safemode=1 to rule out any site-specific differences caused by site-wide styles or script. I then continued on mwdebug1001 with local hacks to slowly strip everything from the page to make it look more like Special:Blankpage, on which the issue does not happen.

After a while I narrowed it down to the use of autofocus on the input field.

Looking for upstream issues regarding FOUC, there are quite a few. Appears to be a regression in Firefox Quantum, reports date back several months ago to when earlier versions of Quantum started being released, and reports mention it consistently. (e.g. 1404468#c4)

Many link to this deeper issue:

I've confirmed that removing autofocus => true from these pages fixes the issue. It seems that as soon as Firefox discovers autofocus="" in the HTML stream, it starts rendering the page and highlighting the input field, and forgets about the blocking stylesheets.

Some of the issues mention a configurable first-paint delay in Firefox's config flags. I tried disabling those or setting a higher delay but that didn't make a difference for me E.g. even with a timeout of 3 seconds and no network delay, there is clearly a FOUC before the styles arrive on a page with autofocus.

Peter added a subscriber: Peter.Dec 5 2017, 8:09 AM
Gilles added a subscriber: Gilles.Dec 5 2017, 3:14 PM
Od1n added a subscriber: Od1n.Dec 6 2017, 9:58 AM

I can also reproduce it with Firefox 57, even without throttling network speed (VDSL2).

Right, in case that wasn't clear, this happens easily, slowing down the connection just makes it happen consistently.

Legoktm added a subscriber: Legoktm.Dec 7 2017, 7:36 PM

I'm basically experiencing this on every Wikipedia page I load, is there anything we can do as a workaround?

Legoktm triaged this task as High priority.Dec 7 2017, 7:37 PM
Od1n added a comment.Dec 10 2017, 1:08 AM

TBH, the fault is in Firefox 57, and the same issue happens on a shitload of websites. So I don't think there is any fix or workaround to consider for MediaWiki, the issue has to be fixed in Firefox.

Od1n added a comment.Dec 12 2017, 2:59 AM

Just to mention the mobile version has this issue on all browsers actually, not only Firefox 57. Tried Chrome and Pale Moon. So maybe the mobile version has a related, but different, issue that would need to be investigated.

Krinkle removed a project: Regression.

Indeed. If you see a rendering problem with the mobile site in a browser other than Firefox, please report it in a new task.

Krinkle moved this task from Backlog to Reported Upstream on the Upstream board.Dec 18 2017, 7:16 PM
Krinkle changed the task status from Open to Stalled.Jan 10 2018, 11:26 PM
Krinkle removed Krinkle as the assignee of this task.
Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)
Krinkle added a subscriber: Krinkle.
Krinkle updated the task description. (Show Details)Jan 10 2018, 11:28 PM
Od1n removed a subscriber: Od1n.Jan 11 2018, 1:07 AM
Krinkle moved this task from Limbo to Watching on the Performance-Team (Radar) board.
Krinkle renamed this task from CSS loading sometimes delayed in Firefox; FOUC reproducibly displayed to Reproducible FOUC on Search and ISBN Lookup (CSS delayed in Firefox) .Mar 5 2018, 9:51 PM
Krinkle updated the task description. (Show Details)Mar 6 2018, 2:22 AM
Krinkle updated the task description. (Show Details)Mar 7 2018, 12:38 AM
Krinkle moved this task from Reported Upstream to Patch proposed upstream on the Upstream board.
Krinkle changed the task status from Stalled to Open.May 7 2018, 8:19 PM


The fix for this bug is part of Firefox 60, which is currently in Beta and should be released as stable this week (May 8).

Confirming that I could reproduce the problem in Firefox 59; Confirming that I cannot reproduce the problem anymore in Firefox 60.
Should this task be closed?

Krinkle closed this task as Resolved.May 14 2018, 12:15 AM
Krinkle claimed this task.