Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Fix for shouldHijackClicks #1915

Closed
wants to merge 3 commits into from
Closed

Fix for shouldHijackClicks #1915

wants to merge 3 commits into from

Conversation

luiz290788
Copy link

Checks if jquery is defined in the when defining shouldHijackClicks. This avoids the event hijack when jquery is defined and avoids the bind of the click event that was causing the click being triggered twice.

@googlebot
Copy link

Thanks for your pull request.

It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/.

If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits.

Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name.

@luiz290788
Copy link
Author

I have just signed the CLA

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@luiz290788
Copy link
Author

I'm the only commiter of the pull request. The other commiters were result of a merge of existing commits.

@ThomasBurleson ThomasBurleson changed the title Fix for issue https://github.com/angular/material/issues/1734 Fix for shouldHijackClicks Mar 31, 2015
@ThomasBurleson ThomasBurleson self-assigned this Apr 2, 2015
@ThomasBurleson ThomasBurleson added this to the 0.9.0 milestone Apr 2, 2015
@ThomasBurleson
Copy link
Contributor

@kennethcachia - let me know what I should do with this PR. Thx.

@jeroenvheel
Copy link

if i apply this change to the current master this issue is also fixed : #1545

  /**
   * MdGesture factory construction function
   */
  function MdGesture($$MdGestureHandler, $$rAF, $timeout) {
    var userAgent = navigator.userAgent || navigator.vendor || window.opera;
    var isIos = userAgent.match(/ipad|iphone|ipod/i);
    var isAndroid = userAgent.match(/android/i);

    var self = {
      handler: addHandler,
      register: register,
      // TODO only hijack clicks on Android < 4.4
      // TODO allow an override for this (through provider?)
      isHijackingClicks: (isIos || isAndroid) && !window.jQuery
    };

    if (self.isHijackingClicks) {
      self.handler('click', {
        options: {
          maxDistance: 6
        },
        onEnd: function (ev, pointer) {
          if (pointer.distance < this.state.options.maxDistance) {
            this.dispatchEvent(ev, 'click');
          }
        }
      });
    }

@kennethcachia
Copy link
Contributor

This change also fixes #1792. We can merge it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants