Page MenuHomePhabricator

Remove the FOUC of the client-nojs JavaScript warning message
Closed, ResolvedPublicBUG REPORT

Description

Feature summary:
Remove (or somehow reduce) the amount of time we are obliged to see the warning message.

Use-cases:
Every time we load a function, we get a flash of the message "This page displays in a limited way without JavaScript."
Per chat discussion, this is "because we don't have server side rendering available at the Foundation, and having two rendering pipelines would have been expensive".
However, minimizing the visibility/distraction of this message would be beneficial.

Benefits:
Reading the message on every page-load is distracting and unhelpful, and potentially disrupts a user's chain-of-thought.

Suggested solution:
Make the required JavaScript load with the page (and not after the page is already loaded), so you don't get that flash effect.

[Filing on behalf of chat discussion participants. Please edit the description if I've misunderstood anything!]

Event Timeline

Jdforrester-WMF changed the subtype of this task from "Feature Request" to "Bug Report".
Jdforrester-WMF moved this task from To Triage to Backlog on the Abstract Wikipedia team board.
Jdforrester-WMF renamed this task from Remove the flash of JavaScript warning message to Remove the FOUC of the client-nojs JavaScript warning message.Feb 15 2024, 2:16 PM
Jdforrester-WMF added a project: WikiLambda.

Could you explain why we are using 2 divs rendered from PHP and hiding them inside the Vue.js app? @DVrandecic @Jdforrester-WMF @gengh
Loading the entire bundle in a synchronous way doesn't seem preferable to me performance wise.

Is there a reason we are not leveraging a <noscript/> tag?

So this:

$parserOutput->setText(
	// Placeholder div for the Vue template.
	Html::element( 'div', [ 'id' => 'ext-wikilambda-app' ] )
		// Add a noscript tag to display a warning message when JavaScript is disabled.
		. Html::rawElement(
		'noscript',
		[],
		Html::element(
			'div',
			[
				'class' => 'ext-wikilambda-view-nojswarning warning',
			],
			wfMessage('wikilambda-viewmode-nojs')->inLanguage($userLang)->text()
		)
	)

Instead of:

. Html::rawElement(
	'div',
	[
		'class' => [ 'ext-wikilambda-view-nojsfallback', 'client-nojs' ],
	],
	Html::element(
		'div',
		[
			'class' => [ 'ext-wikilambda-view-nojswarning', 'warning' ],
		],
		wfMessage( 'wikilambda-viewmode-nojs' )->inLanguage( $userLang )->text()
	)
)

Change #1219583 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] Fix no-JS message flash and improve loading experience

https://gerrit.wikimedia.org/r/1219583

Change #1219583 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix no-JS message flash and improve loading experience

https://gerrit.wikimedia.org/r/1219583

DSantamaria changed the task status from Open to In Progress.Jan 8 2026, 3:13 PM

@DSmit-WMF: This has now been deployed to production; is it good to sign off?