From d180caa0d567154818e884719d3bfe756f48ac9f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 1 Jun 2023 09:32:44 +0200 Subject: [PATCH] Fix closing alert on callback --- umap/static/umap/js/umap.ui.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/umap/static/umap/js/umap.ui.js b/umap/static/umap/js/umap.ui.js index 01e35c13..bf5d338f 100644 --- a/umap/static/umap/js/umap.ui.js +++ b/umap/static/umap/js/umap.ui.js @@ -120,12 +120,11 @@ L.U.UI = L.Evented.extend({ el = L.DomUtil.element('a', { className: 'umap-action' }, this._alert) el.href = '#' el.textContent = action.label - L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', close, this) - if (action.callback) - L.DomEvent.on(el, 'click', () => { - action.callback.call(action.callbackContext || this.map) - close() - }) + L.DomEvent.on(el, 'click', L.DomEvent.stop) + if (action.callback) { + L.DomEvent.on(el, 'click', action.callback, action.callbackContext || this.map) + } + L.DomEvent.on(el, 'click', close, this) } } if (e.duration !== Infinity) {