perliedman / leaflet-control-geocoder

A simple geocoder form to locate places. Easily extended to multiple data providers.
http://www.liedman.net/leaflet-control-geocoder/
BSD 2-Clause "Simplified" License
567 stars 222 forks source link

Search field diappears in Safari #255

Closed docjojo closed 4 years ago

docjojo commented 5 years ago

Search field diappears in Safari

Hello,

when I enter a search string and press return, I get a result list. Moving the mouse over one of the results will hide the result list though – so no way to select a result. Works fine in Firefox and Chrome, but not in Safari (all on a Mac). Any idea?

https://www.liedman.net/leaflet-control-geocoder/

Regards Chris

nrenner commented 4 years ago

This issue now also affects desktop Chrome since Leaflet 1.6.0.

The reason is that L.Browser.touch is now undefined (tested with Chromium 80 on Ubuntu 18.04), so this condition for the default expand option is false:

https://github.com/perliedman/leaflet-control-geocoder/blob/fc30c23cc0e1c0b8c62b47fae4d011e196985ca0/src/control.js#L74-L75

Therefore it falls back to the mouseover/out handling, that somehow doesn't work properly.

Since Leaflet 1.6.0 the definition of L.Browser.pointer has changed to include !webkit (PR #6855), which might get reverted (#6977). And the touch flag depends on the pointer flag.

The original difference with Safari probably was, that it has only been starting to support PointerEvents since last September, so now all main desktop browsers do.

Before Leaflet 1.6.0, L.Browser.touch has been true for all main desktop browsers, so I think that test doesn't really make sense anymore and can probably be removed?

docjojo commented 4 years ago

Great, thank you for the fix. Just downloaded the new version and tested, with Chrome, but no luck. The list still disappears once I move the mouse. Even in the demo, leaflet-control-geocoder-1.12.0=>demo=>index.html

Any ideas?

Bildschirmfoto 2020-02-18 um 08 47 58
docjojo commented 4 years ago

Correction:

I did the same changes in the source I downloaded from https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js and your changes work fine! Just didn't realize, that this change has not been published yet.

nrenner commented 4 years ago

Great to hear that my fix works for you - have you tested both Chrome and Safari?

Just was going to write, that my pull request #272 from yesterday hasn't been merged and released yet and that version 1.12.0 is unrelated to this issue. What apparently has been fixed is that the result list didn't close when selecting a result on a touch iOS device with collapsed: false (#271) - sort of the opposite problem to this one.

docjojo commented 4 years ago

Yes, I can confirm, that this change works on both, Chrome and Safari on my mac. Thank you!