Page MenuHomePhabricator

RelatedArticles should use IntersectionObserver rather than deprecated mediawiki.viewport module
Closed, ResolvedPublic

Description

The mediawiki.viewport module was deprecated in T284179

This task encompasses updating RelatedArticles to use IntersectionObserver and remove usage of the module.

We previously did this in QuickSurveys, so we have an example of how to do this: https://gerrit.wikimedia.org/r/c/698050 , doing this in RelatedArticles will more or less copy that approach.

IntersectionObserver https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API

QA

https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=Related_test

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_test and verify that 3 cards show at the bottom of the page.

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_Articles_3# and drop your Internet connection offline. Scroll to the bottom of page and verify there are no cards.

Restore internet connection and refresh page. Now scroll to bottom of page and verify that you see the three cards.

QA Results - Beta

QA Results - Prod

ACStatusDetails
1T284251#7522153
2T284251#7522153
3T284251#7522153

Event Timeline

@Baalamurgan would you be interested in working on this frontend task?

Let me know if you have any questions regarding setting up the extension, Gerrit, or about this task.

@Baalamurgan how are you getting on with this task?

@Baalamurgan I've removed you as assignee from the task to allow another volunteer to this one. If you'd still like to work on it, please let me know if you have any questions.

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

[mediawiki/extensions/RelatedArticles@master] RelatedArticles should use IntersectionObserver rather than deprecated mediawiki.viewport module

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

Change 734734 merged by jenkins-bot:

[mediawiki/extensions/RelatedArticles@master] RelatedArticles should use IntersectionObserver rather than deprecated mediawiki.viewport module

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

Edtadros subscribed.

Test Result - Beta

Status: ❌ Fail
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

✅ AC1: Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_test and verify that 3 cards show at the bottom of the page.

Screen Shot 2021-11-04 at 7.08.19 AM.png (1×1 px, 314 KB)

✅ AC2: Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_Articles_3# and drop your Internet connection offline. Scroll to the bottom of page and verify there are no cards.

Screen Shot 2021-11-04 at 7.09.41 AM.png (1×1 px, 325 KB)

❌ AC3: Restore internet connection and refresh page. Now scroll to bottom of page and verify that you see the three cards.

Screen Shot 2021-11-04 at 7.11.12 AM.png (1×1 px, 366 KB)

BTW, I recently encountered two details I wasn't familiar with:

"ResizeObserver & IntersectionObserver need to be manually disconnected, else they leak memory through their callback. This happens in all browsers."
https://twitter.com/jaffathecake/status/1405437361643790337

IntersectionObserver is supported in the latest versions of iOS Safari, *but* it can be disabled. For older devices running the latest iOS, it is disabled by default to improve performance.
https://twitter.com/OliverJAsh/status/1456231452870418437

Both seem like edges that could probably affect us. ping @Jdlrobson

Jdlrobson raised the priority of this task from Medium to High.Nov 4 2021, 3:52 PM

Thanks for flagging @TheDJ
Regarding iOS this is a known issue. RelatedArticles is not a critical piece of software.

@Edtadros looks like you've found a bug. Looking and bumping priority...

Jdlrobson moved this task from Doing to QA on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.

Ready for another round of QA.

Opened T295103 to investigate the issues TheDj has flagged.

ovasileva lowered the priority of this task from High to Medium.Nov 10 2021, 1:57 PM

Test Result - Beta

Status: ❌ Fail
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

✅ AC1: Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_test and verify that 3 cards show at the bottom of the page.

Screen Shot 2021-11-10 at 5.35.12 PM.png (1×972 px, 308 KB)

✅ AC2: Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_Articles_3# and drop your Internet connection offline. Scroll to the bottom of page and verify there are no cards.

Screen Shot 2021-11-10 at 5.36.05 PM.png (1×972 px, 264 KB)

❌ AC3: Restore internet connection and refresh page. Now scroll to bottom of page and verify that you see the three cards.

Screen Shot 2021-11-10 at 5.37.18 PM.png (1×972 px, 264 KB)

I was getting to the bottom of the page by using the "end" button, so I figured I'd try using the scroll wheel on my mouse. I refreshed and scrolled down. I was only able to see two cards. I tried this multiple times to see if I could get three but I wasn't able to.

Screen Shot 2021-11-10 at 5.38.09 PM.png (1×972 px, 267 KB)

1-3 cards = Pass. This is an artifact of the testing environment

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

✅ AC1: Visit https://en.m.wikipedia.org/wiki/Stepan_Nechayev and verify that 3 cards show at the bottom of the page.

Screen Shot 2021-11-22 at 2.35.04 PM.png (761×745 px, 170 KB)

✅ AC2: Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Related_Articles_3# and drop your Internet connection offline. Scroll to the bottom of page and verify there are no cards.

Screen Shot 2021-11-22 at 2.38.08 PM.png (761×740 px, 118 KB)

✅ AC3: Restore internet connection and refresh page. Now scroll to bottom of page and verify that you see the three cards.

Screen Shot 2021-11-22 at 2.39.05 PM.png (759×742 px, 170 KB)