javascript - Why doesn't Leaflet provide the correct relatedTarget element on mouseout event? -
i have popup opened when user hovers on marker. currently, popup closes when user hovers on (for example, user can't select text inside popup because closes). i'm trying fix , found great way it, can see here:
http://jsfiddle.net/sowelie/3jbny/
although solution works, version of leaflet used in fiddle old, updated version of leaflet version 1.1.0 , breaks solution 90% of times.
here 2 fiddles, first 1 same working solution old leaflet added 1 console.log
. second 1 has console.log
uses leaflet 1.1.0.
old one: http://jsfiddle.net/3jbny/106/
new one: http://jsfiddle.net/3jbny/105/
notice 100% of times, old solution logs correct relatedtarget
element, popup (of course, when exit marker popup. if exit marker map, it's not going popup).
however, on same solution new version of leaflet, 90% of times relatedtarget
not popup if you're exiting popup time. percentage arbitrary, didn't calculate it, mean if try long enough, new solution log popup relatedtarget
rare.
i want know correct behavior here. in opinion, should work old solution works: giving me correct element i'm exiting to, way can check if i'm exiting popup not close if that's case. why changed?
there workaround correct relatedtarget
without relying on maybe leaflet team patching this? or maybe new solution doesn't rely on relatedtarget
?
i appreciate help!
edit: title said mouseover
meant mouseout
.
found culprit. leaflet classes have css property called pointer-events
set none
, check out here. because of this, event on popup being ignored. fixed overriding property auto
value (in case leaflet-tooltip
class, have similar class popups called leaflet-popup-tip-container
).
check out issue on leaflet's github more information: https://github.com/leaflet/leaflet/issues/5720.
Comments
Post a Comment