Page MenuHomePhabricator

Consolidate scroll and resize event listeners
Closed, ResolvedPublic2 Story Points

Description

Stop binding scroll and resize events around on MobileFrontend, and use the already existing mw.mobileFrontend.on( 'scroll/resize', ... )

Scroll

resources/mobile.backtotop/backtotop.js
8:	$( window ).on( 'scroll', $.debounce( 100, function () {

resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js
33:	$( this.getElementWindow() ).on( 'scroll', this.onWindowScrollDebounced );

resources/mobile.infiniteScroll/InfiniteScroll.js
76:			$( window ).on( 'scroll', $.proxy( this, '_onScroll' ) );

resources/mobile.startup/Skin.js
68:			this.on( 'scroll', function () {

Resize

resources/mobile.mediaViewer/ImageOverlay.js
180:			$( window ).on( 'resize', $.proxy( this, '_positionImage' ) );

Suggested testing, RTL+LTR, portrait+landscape, assuming the code execution path is material as a consequence of this change: https://www.mediawiki.org/wiki/Reading/Web/QA_device_and_browsers_list

Event Timeline

Jhernandez raised the priority of this task from to Needs Triage.
Jhernandez updated the task description. (Show Details)
Jhernandez added a subscriber: Jhernandez.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptJan 27 2016, 10:29 AM
bd808 triaged this task as Normal priority.Jan 27 2016, 6:12 PM
bd808 added a subscriber: bd808.
Jdlrobson moved this task from Backlog to Tasks on the MobileFrontend board.Feb 18 2016, 6:40 PM
Jdlrobson moved this task from Tasks to Tech debt on the MobileFrontend board.Feb 18 2016, 6:43 PM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptApr 27 2016, 4:18 PM

The backtotop module needs this change too.

phuedx set the point value for this task to 2.
bd808 removed a subscriber: bd808.Aug 8 2016, 4:51 PM
dr0ptp4kt updated the task description. (Show Details)Aug 10 2016, 2:09 PM
dr0ptp4kt set Security to None.
Jhernandez updated the task description. (Show Details)Aug 16 2016, 9:13 AM
Jhernandez moved this task from To Do to Doing on the Reading-Web-Sprint-79-Uh-oh board.

Change 304997 had a related patch set uploaded (by Jhernandez):
Combine scroll handlers into the global one

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

Change 304998 had a related patch set uploaded (by Jhernandez):
Combine resize handlers into the global one

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

Change 304999 had a related patch set uploaded (by Jhernandez):
Fix InfiniteScroll to unbind scroll events when disabled

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

The only thing I haven't touched is resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js for now. Going to check what that does and when it is called, so that I can change it and test it.

Change 304997 merged by jenkins-bot:
Combine scroll handlers into the global one

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

Change 304998 merged by jenkins-bot:
Combine resize handlers into the global one

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

Change 304999 merged by jenkins-bot:
Fix InfiniteScroll to unbind scroll events when disabled

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

phuedx removed Jhernandez as the assignee of this task.Aug 18 2016, 11:54 AM
phuedx added subscribers: jhobs, phuedx.

@bmansurov @jhobs: Since @Jhernandez and @Jdlrobson worked on this and merged it, respectively, one of us should be responsible for signing it off. Y'all interested?

jhobs closed this task as Resolved.EditedAug 18 2016, 4:03 PM
jhobs claimed this task.

LGTM.
Tested on several pages at https://en.m.wikipedia.beta.wmflabs.org, including Special:Nearby, Special:EditWatchlist, and 25thjuneChrome.

jhobs removed jhobs as the assignee of this task.Aug 18 2016, 4:04 PM