ec24-tips / ec24-tips.github.io

Local tips for Eurocrypt 2024
https://ec24-tips.github.io/
0 stars 4 forks source link

Bug in Leaflet? #17

Open defeo opened 2 months ago

defeo commented 2 months ago

Whenever a marker is selected, the JS console shows the following uncaught exception:

Uncaught Error: Invalid LatLng object: (NaN, NaN)
    v LatLng.js:32
    unproject Projection.SphericalMercator.js:35
    pointToLatLng CRS.js:41
    unproject Map.js:989
    panInside Map.js:538
    _panOnFocus Marker.js:397
    o DomEvent.js:108
[LatLng.js:32:8](https://unpkg.com/leaflet@1.9.4/src/geo/LatLng.js)
    v LatLng.js:32
    unproject Projection.SphericalMercator.js:35
    pointToLatLng CRS.js:41
    unproject Map.js:989
    panInside Map.js:538
    _panOnFocus Marker.js:397
    o DomEvent.js:108

The same exception is also fired when a marker is selected and the browser tab gains focus: try changing tab and coming back.

This seems specific to Markers: it doesn't happen when a Polyline (e.g., a hike) is selected.

The uncaught exception doesn't affect functionality, it just pollutes the console.

defeo commented 2 months ago

So far my investigation leads me to think this is due to Leaflet Markers having registered an onfocus event which wants to pan something into view, but for some reason the panning ends up not knowing what coordinates to pan to.

I'm unsure whether this is due to a bug in Leaflet or in my code.