Page MenuHomePhabricator

Maps live preview is broken on 2nd attempt
Closed, ResolvedPublicBUG REPORT

Description

  • in your user preferences / editing tab, enable "Use live preview" (at the bottom) and save
  • edit source a page with a mapframe
  • click preview (the preview appears at the top) - check that everything is still ok
  • click preview again - now the map is shifted to the upper left corner inside the mapframe
On first previewOn second preview
pasted_file (393×384 px, 99 KB)
pasted_file (403×386 px, 23 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 348657 had a related patch set uploaded (by JGirault):
[mediawiki/core@master] Live Preview: Attach to the DOM before 'wikipage.content'

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

I can reproduce the described behavior on https://www.mediawiki.org/wiki/Help:Extension:Kartographer but I can not reproduce the behavior on a local wiki. When I add $wgUsejQueryThree = false; to the LocalSettings.php then I can reproduce the behavior. It seams that jQuery 3 fix the problem.

Change 348657 abandoned by Krinkle:
Live Preview: Attach to the DOM before 'wikipage.content'

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

The proposed solution using requestAnimationFrame (or L.Util.requestAnimFrame) works, but I am being careful to not break something. It's gonna require me more testing.

debt moved this task from Stalled/Waiting to Backlog on the Maps-Sprint board.
debt removed a project: Patch-For-Review.
debt subscribed.

Moving to backlog until such time that we can take this up again.

Moving off the sprint board - the Discovery team won't be able to do this work at this time.

It is interesting why jQuery 3 solves this problem.

@Fomafix - would you be able to help fix this bug? Unfortunately, the Maps team doesn't have resources to do it right now.

As far as I see is this problem fixed when T124742 is enabled. It is interesting why jQuery 3 solves this problem and of course where is the problem exactly.

@Fomafix - great! I'll go ahead and decline this particular task then, since it'll be fixed with T124742's release.

This task is still valid, but it is needs to wait for the jQuery update. Reopening and making it the parent of the other one.

The problem is most likely that Kartographer JS code is trying to do something to the page before the dialog finishes loading.

jQuery 3 hides (not solves!) this problem because it calls promise callbacks asynchronously, so they happen slightly later now, and it just luckily for Kartographer now runs when the dialog is ready.

Note, opening the maps modal also triggers the below OOjs UI warning (T166729):

Using the return value of openWindow as a promise is deprecated. Use .openWindow( ... ).opening.then( ... ) instead.

With jQuery 3 I see on the second live preview the following error message in the JavaScript console when I hover the map:

Error: Invalid LatLng object: (NaN, NaN) mapbox-lib.js:1231:9

Maybe this is the same reason.

For the record, I can still reproduce this issue on mediawiki.org when following the steps in the task description.

Fomafix changed the subtype of this task from "Task" to "Bug Report".Mar 2 2019, 2:14 PM

Change 588459 had a related patch set uploaded (by TheDJ; owner: TheDJ):
[mediawiki/extensions/Kartographer@master] Use requestAnimationFrame to fix livepreview problem

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

Jdlrobson subscribed.

https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2020.09.09/clienterror/?id=AXR0cOQp3_NNwgAUScPH

at new L.LatLng  URL1:175:442
at Object.unproject  URL1:180:333
at Object.pointToLatLng  URL1:180:826
at NewClass.unproject  URL1:195:615
at NewClass.layerPointToLatLng  URL1:195:760
at NewClass._fireDOMEvent  URL1:202:145
at NewClass._handleDOMEvent  URL1:201:409
at HTMLAnchorElement.handler  URL1:211:775

URL1: https://commons.m.wikimedia.org/w/load.php?lang=en&modules=dataValues%2Cjquery%2Cmapbox%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7CdataValues.DataValue%7Cext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CkvStore%2CstartUp%7Cext.centralauth.ForeignApi%2Ccentralautologin%7Cext.eventLogging%2Ckartographer%2CnavigationTiming%2CwikimediaEvents%7Cext.kartographer.box%2Cdata%2Cframe%2Clink%2Clinkbox%2Csite%2Cutil%7Cext.kartographer.lib.topojson%7Cext.wikimediaEvents.wikibase%7Cjquery.client%2Ccookie%2Cthrottle-debounce%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Crouter%2Cstorage%2Ctemplate%2Cuser%2Cutil%2Cviewport%7Cmediawiki.ForeignApi.core%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmediawiki.template.mustache%2Cmustache%2Bdom%7Cmediawiki.ui.anchor%7Cmobile.init%2Cstartup%7Cmobile.messageBox.styles%7Cmobile.ooui.icons%7Cmobile.pagelist.styles%7Cmobile.pagesummary.styles%7Cmobile.placeholder.images%7Cmobile.startup.images%7Coojs-ui-core.icons%2Cstyles%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-media%2Cindicators%7Cskins.minerva.icons.images.scripts%7Cskins.minerva.icons.images.scripts.misc%7Cskins.minerva.icons.page.issues.default.color%7Cskins.minerva.icons.page.issues.medium.color%7Cskins.minerva.icons.page.issues.uncolored%7Cskins.minerva.options%2Cscripts%7Cuser.defaults%7Cutil.inherit%7Cwikibase.api.RepoApi%7Cwikibase.datamodel%7Cwikibase.mediainfo.base%2Csearch&skin=minerva&version=fr00w

T280363 is about maplinks. T151524 is about mapframe. These are separate bugs.

Krinkle renamed this task from Maps fast preview is broken on 2nd attempt to Maps live preview is broken on 2nd attempt.Aug 18 2021, 9:40 PM

Change 588459 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Use requestAnimationFrame to fix livepreview problem

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

TheDJ claimed this task.