cyberhobo / wordpress-geo-mashup

Official repository for Geo Mashup, the plugin that makes WordPress into a GeoCMS. Documentation:
https://github.com/cyberhobo/wordpress-geo-mashup/wiki/Getting-Started
63 stars 15 forks source link

subsequent clicks on a once-clicked marker need two clicks to popup #801

Closed answerquest closed 5 years ago

answerquest commented 6 years ago

Awesome plugin, folks. Using leaflet on geo-mashup. When a map is first loaded and we click a marker for the first time, it first shows a loader gif (busy_icon.gif). And then the popup changes to the content (in my case, the post's title).

On the same map, when I have clicked elsewhere and click on this marker for the second time, then NOTHING happens. I have to click it a third time, and then the popup comes. This behaviour repeats itself henceforth : So if I were duly closing popups as and when they came and I repeat-clicked a marker totally 10 times, the popup will come only 5 times. 5 times it'll be a dud click with no response.

I'm reckoning that the map is still firing the loader popup, but that doesn't "load" because the content has already been loaded into memory, and it fails to fire up the content popup, which is then only brought up when user clicks for the second time. This is causing a "sluggish" user experience.

It would be great if the loader gif was on the same popup as our content and was merely replaced by the content when it comes. Here I think it's chaining two popups to fire one after the other that's why there's problems. Also, if I could have a way of replacing the gif with a small "loading..." text, that would be great too, as I'm taking the tiny-visual route and the loader gif is too big.

My page where this is happening : click here. (note: in-development.. link might break in a month or so)

Info: Using leaflet mode. From laptop, Chromium browser on Lubuntu OS.

cyberhobo commented 6 years ago

Thanks for the report. My best guess is that our leaflet abstraction layer needs an update - I'll put that on the queue for 1.11.

answerquest commented 6 years ago

Update: I put the post-preview shortcode [geo_mashup_full_post] further down on a page having the [geo_mashup_map] map. And it seems to indicate the source of this bug. After the markers have had their first clicks, the next time I click a marker,

  1. The popup doesn't appear on the map, but the [geo_mashup_full_post] shortcode location gets populated.

Imgur

  1. Clicking elsewhere in blank areas on the map doesn't remove the post preview content (which is good..).

  2. Second time I click the same marker, the popup appears on the map, and the post preview disappears from the [geo_mashup_full_post] location.

Imgur

Which means that after first time, whenever user clicks a marker, the event to populate the [geo_mashup_full_post] content is fired. And then on next click, the the content preview is removed, and an event to create the on-map popup is fired. This first-blank behaviour occurs irrespective of whether the [geo_mashup_full_post] shortcode is present on the page or not.

So we need to correct the code to fire both the [geo_mashup_full_post] populating and the on-map popup event simultaneously instead of alternating. After the makers have already been clicked once. At least the post preview shouldn't vanish when the on-map popup appears.