Page MenuHomePhabricator

Show no-js fallback of Special:NewLexeme to IE 11 and Safari 9, etc. users
Closed, ResolvedPublic8 Estimated Story PointsBUG REPORT

Description

As a user of IE 11 or Safari 9, I want to see the fallback no-JS page for Special:NewLexeme in order to be able to create new Lexemes.

Problem:
We have a working no-js page for browsers that support no js at all anymore. However, some Browsers support still some Javascript, but not Vue 3 and so cannot display the new app. So we should still show the no-js fallback to them, so they can at least somehow add new Lexemes.

However, currently the fallback page is wrapped in <noscript> tags and so will only show to browsers that have no javascript at all available.

This leaves browsers like IE 11 or Safari 9 falling through the cracks.

Current status in IE11:

VirtualBox_MSEdge - Win10 1_03_08_2022_11_04_25.png (1×1 px, 94 KB)

Acceptance criteria:

  • Browsers that do not support ES6 are shown the no-js fallback, even if they still support some js

Event Timeline

Task Breakdown Notes:

  • We think that the app is currently not showing at all due to the RL flag that limits delivery of js resources to non ES6 clients (see RL Docs)
  • This might mean that we disable this flag and implement feature detection on the JS side (see MDN) to copy the HTML text from the <noscript> Tag and render it.
  • Alternately, we could default to showing the Non JS version by removing it from the <noscript> tag and replacing it with the JS app when it gets mounted, but this is probably not ideal due to flash of interactive content.

Potential Plan of Action:

  1. Figure out a way to detect ES6 (using JS)
  2. Script that is loaded independently of ES6 support to contain this feature detection
  3. If ES6 is available, proceed to load the app as usual
  4. Otherwise, copy the content of the noscript tag and render it's content
  1. Figure out a way to detect ES6 (using JS)

There is a way we can leverage ResourceLoader logic for this! ResourceLoader has a "module registry" (mw.loader.moduleRegistry) that lists all available modules. However, it lists "es6" => true modules only if ES6 is actually available in the browser.

Therefore we could do:

if (mw.loader.moduleRegistry['wikibase.lexeme.special.NewLexemeAlpha'] === undefined) {
    // replace our `<noscript>` tags with their contents here!
}

And we can do so conditionally by using that as a skipFunction in the module definition (docs).

See its example usage: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/heads/master/resources/Resources.php#133

So the above if-condition would instead be inside the skipFunction and then the module would only contain the code to replace our <noscript> tags with their contents.

(Thank You to @Jdlrobson and @Jdforrester-WMF for helping me to understand this better! 🙏)

Change 824504 had a related patch set uploaded (by Noa wmde; author: Noa wmde):

[mediawiki/extensions/WikibaseLexeme@master] Lexidata: detect if es6 exists or not and load content accordingly

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

Change 824504 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Lexidata: detect if es6 exists or not and load content accordingly

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

Change 825240 had a related patch set uploaded (by Noa wmde; author: Noa wmde):

[mediawiki/extensions/WikibaseLexeme@master] Lexidata: change IE11 nojs support to es5

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

Change 825240 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Lexidata: change IE11 nojs support to es5

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

Change 828402 had a related patch set uploaded (by Noa wmde; author: Noa wmde):

[mediawiki/extensions/WikibaseLexeme@master] Lexidata: add separate module for feature detection

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

Change 828402 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Lexidata: add separate module for feature detection

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

Selection_014.png (665×978 px, 69 KB)

This is how it looks on IE11 on Beta now. Happy to screen share if anyone needs to verify any further.