Page MenuHomePhabricator

Load style module for no-JS environments in VoterEligibilityPage (OT)
Closed, ResolvedPublic2 Estimated Story Points

Description

The VoterEligibilityPage uses OutputPage::addModules to add the module ext.securepoll: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/SecurePoll/+/8f16fffa7fc130b5975c7e61324f16700d429978/includes/Pages/VoterEligibilityPage.php#398

The ext.securepoll module loads the file ext.securepoll.css: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/SecurePoll/+/8f16fffa7fc130b5975c7e61324f16700d429978/extension.json#47

OutputPage::addModules only loads a module if JS is enabled, so the CSS isn't being loaded for users without JS.

This results in styling discrepancies such as the field labels not being bold, and margins being too small:

JS enabledJS disabled
image.png (162×382 px, 8 KB)
image.png (134×391 px, 8 KB)

This can be solved by using OutputPage::addModuleStyles.

Event Timeline

Niharika renamed this task from Load style module for no-JS environments in VoterEligibilityPage to Load style module for no-JS environments in VoterEligibilityPage (OT).Jan 6 2021, 7:17 AM
Niharika triaged this task as Medium priority.

Change 657622 had a related patch set uploaded (by Wikitrent; owner: Wikitrent):
[mediawiki/extensions/SecurePoll@master] Replace addModule() with addModuleStyles()

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

Since this was done following T271150: Convert SecurePoll VoterEligibilityPage to use OOUI, the screenshots from the task description are no longer relevant. Updated screenshots of the bug before this patch:

JS enabledJS disabled
image.png (365×723 px, 13 KB)
image.png (309×722 px, 12 KB)

After the above patch, both should look like the picture on the left.

While reviewing this I noticed that some rules in ext.securepoll.css appear unused, so here's a task for looking into that: T272611

Change 657622 merged by jenkins-bot:
[mediawiki/extensions/SecurePoll@master] Replace addModule() with addModuleStyles()

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