The admin bar disappears when a leaflet map is empty but still displayed.
I'm not sure whether to file this as a bug for the Leaflet module or for Backdrop Core.
The reason is that although it seems to be caused by Leaflet (or one of it's submodules), I'd expect Backdrop Core to be able to withstand it.
I noticed the admin bar disappearing in a more complex setup, so decided to test it with a 'clean' setup, so below is a recipe to reproduce the bug.
Unless noted otherwise, leave defaults as is.
Have administration bar enabled.
Install address field, geofield, leaflet, geocoder.
Enable address field, geocode, geofield, leaflet, leaflet more maps, leaflet views.
In leaflet more maps configuration enable bing road layer.
In geocode configuration set Google API Authorization Method to Google API key, Delay between Google geocoding requests (in milliseconds) to 200, check Cache empty results, check Force re-geocoding
Create a content type, named Testleaflet.
Add an address field, named Address, and a geofield to that content type.
Set the geofield widget to geocode from another field, set geocode from field Address, geocoder Openstreetmap Nominatim.
Create a block view, name Leaflettest, showing content of type Testleaflet, set Format Leaflet map with datasource content: geofield and map type Bing Road & satellite hybrid, include Fields address and geofield (hidden), Contextual Filter NID, when the filter value is not available provide default value Content NID from URL.
Create a layout override, named Maptest, using Moscone flipped template, path node/%, visibility condition node type is Testleaflet, add the view Leaflettest to the content region.
Now add content of type Testleaflet, named One. Set a valid address, and see it appear on the map when viewing the content.
Add another item of type Testleaflet, named Two. Leave the address empty or set an invalid address that can't be geocoded.
Now when viewing the item, there is a grey map-box having no markers (this is expected), but the administration bar has disappeared.
When checking the source code of the page, note that in the item One, there is a div with id admin-bar. Additionally, the div with class leaflet-control-scale-line has width set to some 'reasonable' number of pixels (probably under 200, seems dependent on the location and zoom level, initial value seems to be 85px)
In the source code of the page showing item Two, there is no div with id admin-bar. Additionally, the div with class leaflet-control-scale-line has width set to some 'insanely large' number of pixels (786627000 is what I saw in both Firefox and Chromium developer tools) The actual width of the div as shown by the developer tools is only 17895200px (in Firefox, in Chromium the value is 26843486.8, these values will probably be different at different screen resolutions and page zoom levels).
The expected behaviour is that the admin bar is still present and that the width of leaflet-control-scale-line is some 'sane' value (preferably less than or equal to the map width, definitely less than the viewport width).
This was tested in both the Firefox and Chromium browsers.
Should I file this bug under Backdrop Core or the Leaflet module?
Comments
Hi Ernst,
there seem to be a lot of modules involved, so it's not clear which one causes the trouble. I don't think, it's core. But I also don't think it's Leaflet.
I verified with an empty map, which displays fine and doesn't interfere with the admin bar in any way.
The very first thing to inspect is the browser console (log). There must be some errors logged there.
Another thing to check: which jQuery version is active (that's set on admin/config/development/jquery).