Page MenuHomePhabricator

On the mobile site, <mapframe> autozoom doesn't work when data is drawn on top of the basemap and the sections of the page are autocollapsed
Closed, ResolvedPublic

Description

On the mobile site, mapframes display zoomed out to show the whole world if any sort of data (GEOJSON, OSM data or Commons .map pages) are displayed on top of the basemap; the page must be loaded with the relevant section collapsed (collapsing all sections is the default behaviour on phones).

Visit this example page on a phone. The maps above the section break work correctly. Most of the ones below the break do not (the only ones that do are the one where no data is being drawn on top of the base map and the one where the zoom is manually specified).

Note that all maps display correctly if the page is reloaded with the section expanded (because the section remains expanded when the page is reloaded).

QA Results - Prod

ACStatusDetails
1T192250#6045559

Event Timeline

Gareth created this task.Apr 16 2018, 1:00 AM
Restricted Application added a project: Discovery. · View Herald TranscriptApr 16 2018, 1:00 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Based on T193528: [mobile] Zoom controls not displayed in portrait view (closed as a duplicate), the steps to reproduce the issue are as following:

  1. On a mobile device or on Chrome mobile emulator go to https://test2.m.wikipedia.org/wiki/User_talk:Etonkovidova/sandbox (there are few samples of dynamic maps).
  2. A mobile device will display the sections collapsed - click to un-collapse them - the zoom controls will not be dispalayed:

To might be trickier to reproduce the issue In Chrome mobile emulator because after viewing a map in full-view, the zoom controls will be, in fact, displayed. Collapse the sections -reload the page - un-collapse - the controls will be gone:

Mholloway triaged this task as Low priority.Aug 14 2018, 3:59 PM
Mholloway edited projects, added Maps (Kartographer); removed Maps.
TheDJ added subscribers: Jdlrobson, TheDJ.

Almost certainly because we do not trigger invalidateSize() on the map in that case, which we do do for mw-collapsible.. I'm not sure how to be notified of collapsible sections on mobile however.

@Jdlrobson is there a method with which I can reach the Mobile eventbus to listen to section-toggled ?

Almost certainly because we do not trigger invalidateSize() on the map in that case, which we do do for mw-collapsible.. I'm not sure how to be notified of collapsible sections on mobile however.

@Jdlrobson is there a method with which I can reach the Mobile eventbus to listen to section-toggled ?

mw.mobileFrontend.require('mobile.startup').eventBusSingleton.on('section-toggled', (a) => { console.log('hello world', a ); })

Change 582579 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/Kartographer@master] Correct autzoom/center calculations on uncollapsed maps

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

TheDJ added a comment.Mar 22 2020, 2:45 PM

Well this is as best as i can get it I think :/

nray moved this task from Needs triage to Triaged on the Mobile board.Mar 23 2020, 11:49 PM

Change 582579 merged by jenkins-bot:
[mediawiki/extensions/Kartographer@master] Correct autozoom/center calculations on uncollapsed maps

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

Jdlrobson added a subscriber: JTannerWMF.

We should probably QA this unless there is another team doing this. @JTannerWMF can you advise?

TheDJ added a comment.Apr 8 2020, 8:23 AM

For QA. To clarify, the patch will ONLY fix the situation where a map is initially in a collapsed state and a user then uncollapses this section manually.

ovasileva assigned this task to Edtadros.Apr 8 2020, 4:02 PM
Edtadros reassigned this task from Edtadros to ovasileva.Apr 10 2020, 6:27 AM
Edtadros added a subscriber: Edtadros.

Test Result - Prod

Status: ✅ PASS
Environment: commons
OS: macOS Catalina
Browser: Chrome
Device: MBP
Emulated Device: iPhoneX

Test Artifact(s):

QA steps

Go to https://commons.m.wikimedia.org/wiki/User:Gareth/maps/test2
Expand section break
✅ AC1: Verify that mapframes DO NOT display zoomed out to show the whole world if any sort of data (GEOJSON, OSM data or Commons .map pages) are displayed on top of the basemap; the page must be loaded with the relevant section collapsed (collapsing all sections is the default behaviour on phones).

Edtadros updated the task description. (Show Details)Apr 10 2020, 6:28 AM
ovasileva closed this task as Resolved.Apr 10 2020, 8:33 AM

Looks good!