Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't fire click event if default is prevented on mousedown for a drag event #6697

Merged
merged 1 commit into from
May 21, 2018

Conversation

mollymerp
Copy link
Contributor

fix #6642

in #6218 we stopped checking if the mouse position had changed before firing a click event. the DragPanHandler suppresses its associated click event on mouseup

DOM.suppressClick();

but if preventDefault() is called on mousedown the click was no longer being suppressed after a drag which caused the change in behavior in #6642

I added a drag simulation that allows you to specify different options for mousedown/mouseup but I'm open to other ideas on how to test this.

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • manually test the debug page

Copy link
Contributor

@jfirebaugh jfirebaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a bit weird to suppress the click based on this particular condition (for instance, why should there be an exception to the suppression if you happen to drag exactly back to the starting position?), but since it was the existing behavior for so long I suppose compatibility does take precedence.

@mollymerp mollymerp merged commit 6cbfe8c into master May 21, 2018
@mollymerp
Copy link
Contributor Author

yeah I agree its an odd condition to have had in the first place 🤷‍♀️

@mollymerp mollymerp deleted the click-drag-fix branch May 21, 2018 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.45.0 breaks mapbox-gl-directions plugin/example
2 participants