I created lightning component for a map, Im using Leaflet library to display map and points on it , on desktop ( mouse devices) it works well ( click, pan, zoom ), but on touch screen it does not work when I open the map on real ipad, I have this error message:

TypeError:Can only call MouseEvent.initMouseEvent on instances of MouseEvent throws at https://{my domin}.lightning.force.com/auraFW/javascript/rNSAVNTno4PUWiQm9PXAFg/aura_prod_compat.js:825:143

when I open it on chrome ipad simulation , I have this error message : (it was lightning App)

Uncaught TypeError: Illegal invocation throws at https://{my domin}.lightning.force.com/auraFW/javascript/rNSAVNTno4PUWiQm9PXAFg/aura_prod.js:824:138

I dont think it is leaflet issue because leaflet examples on their website works fine on mobile

please help

  • can you post your code here – Manjot Singh Nov 2 '17 at 4:49
  • 1
    code does not have anything about mouse interaction, these mouse events for map point click and map pan are default in leaflet library – sundus Nov 2 '17 at 7:35

I found the answer: add this option to map object: tap:false

  map =  L.map(mapElem,{tap:false});

and it will be solved, because it seems there is a conflict between tap implementation in leaflet and tap (click) implementation in salesforce

| improve this answer | |

Worked for me, too. Many thanks. I added tap:false into the map initialisation:

var map = L.map(mapDiv, {zoomControl: false, tap:false}).setView([51.506246, -0.086292], 14);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.