Closed hubnerd closed 4 years ago
Good idea, thanks for the PR. Although I do think it's better to use e.preventDefault
instead. I don't like blocking propagations.
Step 1 is call e.preventDefault
in the button click of leaflet-geosearch
.
Step 2 is for the user, to check if his click is not prevented higher on the chain, with e.isDefaultPrevented
.
Can you adjust this PR accordingly?
Sorry for the time this took, not had a minute to myself lately. Build is clean but the build fails due to googleprovider test
Personally, I would prefer just using stopPropagation
. If you really want to let user's listen to the control's click events higher up, why don't we just make it configurable? Just have a stopPropagation
option (true/false) that registers the form click event. Otherwise, it will bubble up like normal. Straightforward, and they don't have to check e.originalEvent.defaultPrevented
in every single other event handler they've registered on the map.
Fair enough. I'm in for @Azmisov's suggestion. Could someone adjust this PR to add a stopPropagation
option which defaults to true
?
leaflet-geosearch v3
has been released, and embeds this fix.
Thanks for your contribution.
Hi,
I have added an option "stopClickPropagation" to stop propagation on click to allow people to be able to use something like map.on('click', function() { alert("Click") }); and not have it trigger on clicking the search form.
I have also added autocomplete="none" to the search form due to web browsers trying to autocomplete and hiding the search results.
Not sure if you want these commits but I thought I would chuck them your way :)