Skip to content

Fixed Mapbox Touch Event on Mobile After Switching Back from Select Mode #6281

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

Merged
merged 3 commits into from
Aug 12, 2022

Conversation

mmtmr
Copy link
Contributor

@mmtmr mmtmr commented Jul 28, 2022

Note: "Mobile" in the following context means touch screen device.

Issue: When mobile user switched back to "Pan" mode from "Box Select" or "Lasso Select" on the mapbox graph, the user is unable to trigger events (eg: hover, click) that are initially trigger-able before switching to "Select" mode.

Problem: The event listener of "touchStart" is not removed.

Solution: Added remove event listener of "touchStart" code below remove event listener of "mouseDown" code when the mapbox graph is not in "Select" mode.

Other Observation: Double Touch on Screen to Clear Selection on "Pan" mode is not working after implementing this solution. But I guess it shouldn't be working at first since double click on "Pan" in non-mobile settings is also not clearing the selection.

Example: First graph in https://plotly.com/python/mapbox-layers/

@archmoj archmoj added bug something broken community community contribution status: reviewable labels Jul 28, 2022
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

💃 Thanks @mmtmr - nicely done!

@archmoj let's merge as is, but perhaps in the future we can implement a dragElement.remove or some such to reverse a dragElement.init call, and keep this logic all contained in dragElement? Not really sure why this is the first time we've encountered this issue, is mapbox the only place the element is reused, rather than removed and recreated?

@archmoj archmoj merged commit 508e316 into plotly:master Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken community community contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants