https://www.drupal.org/project/leaflet/issues/3366240 🐛 Uncaught TypeError Fixed
After updating Leaflet, I'm getting an error reported in console.
Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf')
Source: drupal.js?v=9.5.9:14
Reported at the following relevant locations:
Drupal.Leaflet.initialise @ leaflet.drupal.js?v=9.5.9:251
Drupal.Leaflet @ leaflet.drupal.js?v=9.5.9:202
loadMap @ leaflet.drupal.js?v=9.5.9:23
(anonymous) @ leaflet.drupal.js?v=9.5.9:168
each @ jquery.min.js?v=3.6.3:2
attach @ leaflet.drupal.js?v=9.5.9:8
In my settings array for Leaflet, the key "zoomControlPosition" was missing.
$leaflet_map_settings = [
'dragging' => TRUE,
'touchZoom' => TRUE,
'scrollWheelZoom' => FALSE,
'doubleClickZoom' => TRUE,
'zoomControl' => TRUE,
'zoomControlPosition' => 'topleft', // <-- Important
'attributionControl' => TRUE,
'trackResize' => TRUE,
'fadeAnimation' => TRUE,
'zoomAnimation' => TRUE,
'closePopupOnClick' => TRUE,
'map_position_force' => FALSE,
...
];
Fixed
1.0
Code