Page MenuHomePhabricator

Minerva font size setting should use new client side preferences
Closed, ResolvedPublic2 Estimated Story Points

Assigned To
Authored By
Jdlrobson
Jul 19 2023, 4:47 PM
Referenced Files
F37740789: screenshot 21.mov.gif
Sep 20 2023, 1:29 AM
F37740785: screenshot 20.mov.gif
Sep 20 2023, 1:29 AM
F37740783: screenshot 19.mov.gif
Sep 20 2023, 1:29 AM
F37740781: screenshot 18.mov.gif
Sep 20 2023, 1:29 AM
F37739905: screenshot (2).png
Sep 19 2023, 5:38 PM
F37739904: screenshot (1).png
Sep 19 2023, 5:38 PM
F37730083: screenshot 59.png
Sep 19 2023, 5:38 PM
F37730081: screenshot 58.png
Sep 19 2023, 5:38 PM

Description

NOTE: Blocked on T345664

It is important for us to verify the new client side preferences can be applied to mobile. This presents a good opportunity to fix a longstanding issue with the mobile site.

Currently changing the font size on Minerva leads to a visible flash as the font kicks in this. Given the changes in core in T339268 we can now resolve this issue.

We'd like to extend the existing client side preferences to the mobile site

TODO

  • Update Minerva to use new client side preferences (where available). You may need to enable the associated skin option (https://gerrit.wikimedia.org/r/c/mediawiki/core/+/947479)
  • Note: for logged in users client side preferences are stored to user preference so this will likely involve adding a Minerva-specific preference.
  • Think about existing consumers. Check mw.storage.set( 'userFontSize') in your code and call mw.user.clientPrefs when it has been set (you'll also need to add the appropriate NEW class on the HTML element). Flash of unstyled content here is okay.

Note: No need to worry about cached HTML as the existing Minerva preference is a JavaScript only feature.

QA

Test 1) On mobile site as anonymous user:

  • Go to Special:MobileOptions
  • Toggle font size to extra large
  • Visit an article page
  • Font size for paragraphs in content should be XL. There should be no visible change in font size on page load.

Expected:

Repeat the above as a logged in user

Test 2) Check existing consumers

Open mobile site in an incognito window.

In your JavaScript console run the following code:

localStorage.setItem( 'userFontSize', 'x-large' )

Refresh the page.

Expected: you should see the extra large font size (with a flash of unstyled content).

Notes:

  • Make sure all the font size options result in different font sizes on the page
  • Make sure the font size does not visually change to the user
  • Test workflow for logged out users (note given caching it's acceptable for the feature to work on recently edited pages but not older cached pages)
  • Test workflow for logged in users

Sign off step

  • Document the process to make sure this is easier in future.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Jdlrobson triaged this task as Medium priority.Jul 19 2023, 4:47 PM
Jdlrobson moved this task from Backlog to TODO on the MinervaNeue board.
bwang set the point value for this task to 3.Jul 20 2023, 5:50 PM
Jdlrobson raised the priority of this task from Medium to High.Aug 8 2023, 6:15 PM

High as we want to validate the new code in core can be utilized on the mobile site. This will also fix an existing issue with the site.

As I started working on this task there were I few things I wasn't expecting, so I'm noting them below:

  1. The Special:MobileOptions page, as well as the associated controls for the Minerva font size, actually live in MobileFrontend.
  2. The associate font-size CSS also live in MobileFrontend
  3. There seems to be a dependency on this task https://gerrit.wikimedia.org/r/c/mediawiki/core/+/947480 to allow extensions or skins to declare clientPref keys in the skin.json/extension.json

Intuitively it seems like the font-size option should live in the MinervaNeue skin, but the Special:mobileOptions page is tightly bound to mobileFrontend since it relies on config options and other MF specifics.

Change 950198 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/extensions/MobileFrontend@master] [WIP] Use clientPrefs for mobile user font size

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

ovasileva changed the point value for this task from 3 to 5.Aug 21 2023, 5:20 PM

Change 951179 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/skins/MinervaNeue@master] Enable clientPrefs inline script

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

ovasileva changed the point value for this task from 5 to 3.Aug 28 2023, 5:19 PM
ovasileva subscribed.

Re-estimating for remaining work, to be done in sprint 5.

Change 951179 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Enable clientPrefs inline script

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

Following conversation in estimation we want to enable client preferences for logged in users and not introduce a font size preference for Minerva.

Jdlrobson changed the point value for this task from 3 to 2.Sep 11 2023, 5:19 PM
Jdlrobson set Final Story Points to 5.

Change 957965 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/extensions/MobileFrontend@master] Use clientPrefs for mobile user font size

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

Change 957965 abandoned by Jdlrobson:

[mediawiki/extensions/MobileFrontend@master] Use clientPrefs for mobile user font size

Reason:

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

Change 950198 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Use clientPrefs for mobile user font size

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

Test Result - Beta

Status:
Environment: beta
OS: macOS Ventura
Browser: Chrome
Device: MBA
Emulated Device:NA

Test Artifact(s):

QA Steps

Test 1) On mobile site:

Visit mobile site
Click settings cog
Change font size
Visit a page and see font size has changed
Tests

✅ AC1: Make sure all the font size options result in different font sizes on the page
See below.

✅ AC2: Make sure the font size does not visually change to the user
@Jdlrobson, I'm not sure what this means.

✅ AC3: Test workflow for logged out users (note given caching it's acceptable for the feature to work on recently edited pages but not older cached pages)
See below.

✅ AC4: Test workflow for logged in users
Tested for both AMC and non-AMC. See below.

Logged Out

smallregularlargeextra large
screenshot 48.png (753×347 px, 159 KB)
screenshot 49.png (753×347 px, 152 KB)
screenshot 50.png (753×347 px, 96 KB)
screenshot 51.png (753×347 px, 92 KB)

Logged In (AMC = OFF)

smallregularlargeextra large
screenshot 52.png (753×347 px, 160 KB)
screenshot 53.png (753×347 px, 152 KB)
screenshot 54.png (753×347 px, 97 KB)
screenshot 55.png (753×347 px, 92 KB)

Logged In (AMC = ON)

smallregularlargeextra large
screenshot 56.png (753×347 px, 160 KB)
screenshot 57.png (753×347 px, 153 KB)
screenshot 58.png (753×347 px, 97 KB)
screenshot 59.png (753×347 px, 93 KB)

Test 2) Check existing consumers

Open mobile site in an incognito window.
In your JavaScript console run the following code:
localStorage.set( 'userFontSize', 'x-large' )
Refresh the page.
❓ AC5: you should see the extra large font size (with a flash of unstyled content).

@Jdlrobson, the command above yields an error.

screenshot (1).png (200×994 px, 38 KB)

I tried setItem instead, and while I didn't get an error, I got this upon reload and there was no change in font size.
screenshot (2).png (302×986 px, 121 KB)

Change 959035 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@master] Fixes cannot read properties of undefined

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

Change 959010 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/MobileFrontend@wmf/1.41.0-wmf.27] Fixes cannot read properties of undefined

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

Change 959035 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Fixes cannot read properties of undefined

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

Change 959010 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@wmf/1.41.0-wmf.27] Fixes cannot read properties of undefined

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

Mentioned in SAL (#wikimedia-operations) [2023-09-19T20:18:02Z] <brennen@deploy2002> Started scap: Backport for [[gerrit:959010|Fixes cannot read properties of undefined (T342277)]]

Mentioned in SAL (#wikimedia-operations) [2023-09-19T20:38:34Z] <brennen@deploy2002> jdlrobson and brennen: Backport for [[gerrit:959010|Fixes cannot read properties of undefined (T342277)]] synced to the testservers mwdebug1002.eqiad.wmnet, mwdebug2001.codfw.wmnet, mwdebug2002.codfw.wmnet, mwdebug1001.eqiad.wmnet, and mw-debug kubernetes deployment (accessible via k8s-experimental XWD option)

Okay this should be ready for another round of QA and it can be tested in production @ https://test.wikipedia.org

Mentioned in SAL (#wikimedia-operations) [2023-09-19T20:55:41Z] <brennen@deploy2002> Finished scap: Backport for [[gerrit:959010|Fixes cannot read properties of undefined (T342277)]] (duration: 37m 39s)

Test Result - Beta

Status: ❓Need More Info
Environment: beta
OS: macOS Ventura
Browser: Chrome
Device: MBA
Emulated Device:NA

Test Artifact(s):

QA Steps

Test 1) On mobile site as anonymous user:

Go to Special:MobileOptions
Toggle font size to extra large
Visit an article page
Font size for paragraphs in content should be XL.
✅ AC1: There should be no visible change in font size on page load.

screenshot 18.mov.gif (734×346 px, 219 KB)

✅ AC2: Repeat the above as a logged in user
AMC=ON

screenshot 19.mov.gif (734×346 px, 266 KB)

AMC=OFF
screenshot 20.mov.gif (734×346 px, 235 KB)

Test 2) Check existing consumers

Open mobile site in an incognito window.

In your JavaScript console run the following code:

localStorage.set( 'userFontSize', 'x-large' )
Refresh the page.

❓ AC3: Expected: you should see the extra large font size (with a flash of unstyled content).
@Jdlrobson, can you confirm that the correct command is setItem instead of set (which gives an error). Additionally I did try it out with both. set doesn't do anything, but setItem does appear to work. However, it only works if I reload the page twice. I can't understand why that is. I thought it was time, but I tested it and waited about 30sec before I reloaded, and sure enough, it didn't do anything until i hit reload a second time.

screenshot 21.mov.gif (1×1 px, 899 KB)

Notes:

✅ AC4: Make sure all the font size options result in different font sizes on the page
✅ AC5: Make sure the font size does not visually change to the user
✅ AC6: Test workflow for logged out users (note given caching it's acceptable for the feature to work on recently edited pages but not older cached pages)
✅ AC7: Test workflow for logged in users
AC4-7 see T342277#9180055

brennen subscribed.

Removing as train blocker since I believe the relevant stuff was patched yesterday. Please correct if I'm mistaken.

@Jdlrobson, can you confirm that the correct command is setItem instead of set (which gives an error). Additionally I did try it out with both. set doesn't do anything, but setItem does appear to work. However, it only works if I reload the page twice. I can't understand why that is. I thought it was time, but I tested it and waited about 30sec before I reloaded, and sure enough, it didn't do anything until i hit reload a second time.

Yep setItem is the correct command here. The reloading the page twice wasn't expected but is acceptable for a pass.

Please move to QA in production after documenting learnings from this exercise (issues we encountered with logged in users)