lundi 9 novembre 2015

Ember, google maps, and mobile safari click event not attaching

I am having a very weird issue with ember + google maps + jQuery where jQuery's .on() handler is not properly filtering data attributes.

I have a google map that is served by an Ember application. I then have ember components wrapped in a google map OverlayView. Inside the overlay component i have several click handlers all wrapped up using {{action 'myclick'}} syntax.

On normal devices this works perfectly fine. But for some reason on mobile devices and in particular iOS based devices the click event only halfway propagates up to the global body event handler.

To explain the problem further this is the handler that brings the event into ember land normally.

rootElement.on(event + '.ember', '[data-ember-action]', function (evt) {

Its from this line in the ember source. http://ift.tt/1iPpOMg

For some reason the click handler is not hitting it. But if i alter the handler to this signature

rootElement.on(event + '.ember', function (evt) { Then all the sudden the event handler attaches and fires properly even though this is the DOM element i'm pressing.

<button class="button button-close infobox-close-link" data-ember-action="2096"></button>

I've tried attaching click handlers at different points in the DOM tree under the google maps node to no avail. If i try and filter based on any data attribute at all it never fires. What is odd is that all other {{action}} handlers outside of google maps work just fine under iOS.

What is really strange is that if i change my action handler to {{action 'myclick' on="touchEnd"}} then everything works as expected and the .on() filter works.

I tried replicating the issue in a fiddle but so far have had no luck.

FYI i've already set the class for everything to pointer: cursor.




Aucun commentaire:

Enregistrer un commentaire