Template talk:OSM Location map/Archive 2
![]() | This is an archive of past discussions about Template:OSM Location map. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 | Archive 2 |
Bug with layering
Currently, in any map using this template (as far as I can tell), there is an issue with layering (z-index) on the maps. The HTML generated for part of the map (the one which includes the labels, as well as a few other things), has a z-index of 1. Meanwhile, the layer which contains the links to Wikimedia, OpenStreetmap, and the actual fullscreen button (which currently only works due to a weird tooltip in the z-index 1 layer of the map). This means that the links are not possible to click (tested in multiple browsers).
To resolve this issue, the classes "mw-kartographer-fullScreen" and "mw-kartographer-attribution" should get z-index of 2, or the elements with those classes in this particular template should have inline styles giving them that z-index. The one thing to be aware of is to not give the element surrounding them z-index of 2, as this would break the labels in the z-index of 1 layer. TheTrueShaman (talk) 22:54, 31 March 2024 (UTC)
- TheTrueShaman, Thanks for raising this, although I am not sure if I am understanding correctly, so apologies if the following makes no sense.
- The starting point for this template is a system which no longer works, so this design is trying to replicate that by other means. The reason to use it (rather than just using {{maplink}}) is to get access to all sorts of non-maplink features to show on top of the map. It now relies on maplink for the basemap so the first challenge was to get a working overlay, and then to not have wikilinks to unhelpful items. To my mind, a fullscreen maplink which doesn't include the added items would come into that category. The wierd tooltip is the solution I came up with that wiki-links to a second version of maplink, which then also adds in the dots from the location map (potentially ignoring anything an editor decides to exclude, eg river names or neighbouring regions, or whatever). (ie it only works because it has been made to do something specific. It is not just passing through to original maplink link). The other working wikilinks are those which a particular map editor has added within a label, or via a shape. (The List of college bowl games#Map of Division I bowl games is a good example). This is, for better or worse, behaving as intended.
- I am aware that my over-limited html knowledge means I don't know about the z-indexes or classes you mention, and am not sure what outcome they might acheive. If the explanation above is missing your point, my apologies, and by all means explain further. But I believe that the various link options are at least doing something useful, if in a slightly roundabout way. RobinLeicester (talk) 17:39, 2 April 2024 (UTC)
- Hey RobinLeicester, thanks for the prompt response. If I'm correctly understanding you, you have also correctly understood me (mostly, I think). I now understand why you have implemented the weird tooltip and why the normal fullscreen button doesn't work. I also now understand that what I wanted to do would likely be infeasible (due to the code relying on another template), and would likely not be productive.
- However, I still think it would be quite useful to have the links in the bottom right functioning. This is because these links send you to the legal rights pages surrounding these maps: Wikimedia and OpenStreetMap. I find that these links in the bottom right could be quite useful to readers due to them providing information on what they can do with the map data and how it was found. And I think I may have figured out how to do this. Inline CSS!
- If you were to put the following code in front of the rest of the template code, this will actually make these links clickable. <style>.mw-kartographer-attribution { z-index:2 } </style>
- Now it's up to you to decide if this is a good idea or not. TheTrueShaman (talk) 17:52, 7 April 2024 (UTC)
- Thanks, I will give that a go. Looks to makes sense! On a separate issue, and just in case you can make any headway on this, you will see below that Mobile view is not happy with this as currently working. I have found it is not just the fullscreen link that is affected. All the marks and labels are being shunted upwards by 30px, so are currently in completely the wrong places. To get the standard page working I had made a very ungainly cludge with the {{Overlay}} height= parameter, which somehow gets the marks to the right place, (It needs to be frame-height-7 for whatever reason). Initial invetsigation into mobile view suggests that needs to be frame-height-37. (Again, no idea why). But to do this I need to test if mobile is in use, and I have not found a way to discover that. {{If mobile}} doesn't work within a template as the div items it uses just confuses the parser, I think. There is promising looking stuff at https://www.mediawiki.org/wiki/Extension:MobileDetect, but I know nothing about how to get it to work on en:wikipedia, or how to use it in a template if it did. I have not yet had time to pursue this so if you have any insights to offer (or know who to ask) that would be much appreciated. RobinLeicester (talk) 21:42, 7 April 2024 (UTC)
- Hello Robin, turns out I gave false hope. I tried adding the styles for elements, but it didn't work because MediaWiki wikis do not allow the <style> tag to turn into HTML, rather forcing it to display as plaintext. Someone else had a similar problem, but they never found a solution either, on stack overflow. I see you also tried too, but failed similarly, so unfortunately I fear that this issue will likely remain until the graph extension comes back.
- Thanks, I will give that a go. Looks to makes sense! On a separate issue, and just in case you can make any headway on this, you will see below that Mobile view is not happy with this as currently working. I have found it is not just the fullscreen link that is affected. All the marks and labels are being shunted upwards by 30px, so are currently in completely the wrong places. To get the standard page working I had made a very ungainly cludge with the {{Overlay}} height= parameter, which somehow gets the marks to the right place, (It needs to be frame-height-7 for whatever reason). Initial invetsigation into mobile view suggests that needs to be frame-height-37. (Again, no idea why). But to do this I need to test if mobile is in use, and I have not found a way to discover that. {{If mobile}} doesn't work within a template as the div items it uses just confuses the parser, I think. There is promising looking stuff at https://www.mediawiki.org/wiki/Extension:MobileDetect, but I know nothing about how to get it to work on en:wikipedia, or how to use it in a template if it did. I have not yet had time to pursue this so if you have any insights to offer (or know who to ask) that would be much appreciated. RobinLeicester (talk) 21:42, 7 April 2024 (UTC)
- As for your mobile/desktop detection issue, I'm afraid that the {{If mobile}} template won't work. This is because the entire template relies on css, meaning that no text changes, it just hides text from displaying depending on if you're on desktop or mobile. This means that the template can't be processed in some way to get the page's state and do calculations with that. I'm sorry for being unable to help. TheTrueShaman (talk) 00:05, 8 April 2024 (UTC)
, sort of, re links bottom-right of the maps. I have added links to the maps terms of use and OSM page, over the little arrow symbols. It is not a livelink to the words that the maplink page has, but anyone looking for the link would hopefully find where to click. A tooltip pops up on hover as well. RobinLeicester (talk) 13:17, 26 April 2024 (UTC)
- Awesome, thanks for finding a workaround! TheTrueShaman (talk) 05:08, 30 April 2024 (UTC)
- As for your mobile/desktop detection issue, I'm afraid that the {{If mobile}} template won't work. This is because the entire template relies on css, meaning that no text changes, it just hides text from displaying depending on if you're on desktop or mobile. This means that the template can't be processed in some way to get the page's state and do calculations with that. I'm sorry for being unable to help. TheTrueShaman (talk) 00:05, 8 April 2024 (UTC)