Leaflet.DistortableImage icon indicating copy to clipboard operation
Leaflet.DistortableImage copied to clipboard

Bug in safary 14.0: sourceCapabilities is undefined

Open Arunar-betta opened this issue 4 years ago • 4 comments

Any click on the map in safary 14.0 causes the following error: TypeError: undefined is not an object (evaluating 'i.sourceCapabilities.firesTouchEvents')

Can be reproduced even in live demo https://publiclab.github.io/Leaflet.DistortableImage/examples/index.html

Arunar-betta avatar Nov 03 '20 09:11 Arunar-betta

Thanks for opening your first issue here! Please follow the issue template to help us help you 👍🎉😄 If you have screenshots to share demonstrating the issue, that's really helpful! 📸 You can make a gif too!

welcome[bot] avatar Nov 03 '20 09:11 welcome[bot]

i believe it! Im checking into it now thank you for reporting this

sashadev-sky avatar Nov 18 '20 18:11 sashadev-sky

So its "experimental" according to MDN" but here is a good link about it if interested and also @jywarren https://developers.google.com/web/updates/2015/10/inputdevicecapabilities.

What it dose is indicate if the browser has native input touch event (not all do), so we can fire a synthetic one if it doesn't and don't end up firing it twice if it does.sourceCapabilities is a ? for status in safari https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/sourceCapabilities so a few options:

  1. Just for @Arunar-betta right now, this bug occurs only on double clicking the map. This wiki describes how to turn the functionality off: https://github.com/publiclab/Leaflet.DistortableImage/wiki/singleclick-event.
  2. Or we can just use optional chaining, 1 line change i?.sourceCapabilities?.firesTouchEvents and error is gone
  3. Ideally someone can take a fresh look. Tap events were broken on Leaflet when I implemented this, and we also specifically wanted images to be deselected on map click, but not dblclick (which is for the map labels), so I digressed from their source code a bit. Our touch usability is degrading a bit, sometimes double tap will deselect the image on my iPhone now. Another thing is that when you're done dragging an image, the toolbar is meant to re-appear again and it no longer does this. Maintenance burden :(

sashadev-sky avatar Nov 19 '20 10:11 sashadev-sky

@jywarren and @TildaDares can I work on this ?

julianavmgiusti avatar Oct 17 '22 11:10 julianavmgiusti