Page MenuHomePhabricator

Do not show groups in Kartographer's layer control which are empty
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • In the layer control on the right side all possible groups (about 25) are shown but most of them are senseless because these groups have no elements.

What should have happened instead?:

  • Only these groups should be shown which contain element. This was the previous behavior for several years.
  • If you will not press on the map's full screen control but on the magnify button right of the map title then a full-screen map occurs which uses a layer control with the expected behavior.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

  • The mapframe show parameter contains 25 elements because it is impossible to forecast with Lua scripting which groups are used all over the page. Please note that in Wikivoyage the markers are not defined in a single mapframe call but are defined in individual maplink definitions.

Event Timeline

These extra groups are injected by https://de.wikivoyage.org/wiki/MediaWiki:Gadget-MapTools.js . They are also filtered out correctly by that gadget, so if you click the globe icon at the top you see a Kartographer map with the correct layers.

I agree that Kartographer should work around this by filtering empty layers as is done in https://de.wikivoyage.org/wiki/MediaWiki:Gadget-MapTools.js#L-407 .

A comment in order to avoid a misunderstanding:

The default mapframe maps as generated by the Mediawiki software are untouched by the https://de.wikivoyage.org/wiki/MediaWiki:Gadget-MapTools.js gadget, and the gadget will not inject additional groups to these maps.

The gadget will produce only extra maps, mostly in full-screen mode. As noted above, the empty groups are correctly filtered out by this gadget. The bug described occured since maximumly two weeks whereas the last modification of the gadget was about seven weeks ago. At the English Wikivoyage, the same bug occured but the gadget mentioned is not used in this wiki.

At least it seems that the issue is related to the fact that there's code[1] or there are templates[2] to add a preset of groupnames to the mapframes show attribute. Currently this is used as convenient shortcut so authors do not have to add the commonly used groups by hand on every mapframe. This shortcut works ( or worked ) because until recently empty groups were hidden in the layer controls even if they're explicitly added to in the show attribute.

This premise seem to have changed now. You could probably argue if an empty layer should still show up in the controls if it's explicitly added to show. The reality of how this is used on the wikis is different though so I agree, that we should filter them out.

[1] e.g. https://de.wikivoyage.org/wiki/Modul:Marker_utilities/Groups#L-21 or https://de.wikivoyage.org/wiki/MediaWiki:Gadget-MapTools.js#L-571
[2] e.g. https://en.wikivoyage.org/wiki/Template:Maplayers

Change 902440 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/Kartographer@master] Don't add empty groups to the map

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

Change 902440 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Don't add empty groups to the map

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

WMDE-Fisch moved this task from Doing to Demo on the WMDE-TechWish-Sprint-2023-03-14 board.

Change 902712 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: WMDE-Fisch):

[mediawiki/extensions/Kartographer@master] Don't show unnamed groups in layer controls

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

Change 902712 merged by jenkins-bot:

[mediawiki/extensions/Kartographer@master] Don't show unnamed groups in WikiVoyage layer controls

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