Uncaught TypeError

Created on 2 November 2023, 8 months ago
Updated 19 June 2024, 7 days ago

Related

https://www.drupal.org/project/leaflet/issues/3366240 πŸ› Uncaught TypeError Fixed

Problem

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

Proposed solution

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,
      ...
];
πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡ΉPortugal rutiolma

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024