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

Switch from legacy mouse/touch events to newer pointer events #5505

Closed
bhousel opened this issue Nov 20, 2018 · 2 comments
Closed

Switch from legacy mouse/touch events to newer pointer events #5505

bhousel opened this issue Nov 20, 2018 · 2 comments
Assignees
Labels
touch-stylus An issue with touchscreen or pen input usability An issue with ease-of-use or design
Milestone

Comments

@bhousel
Copy link
Member

bhousel commented Nov 20, 2018

This is a followup from #5492

iD's support for touchscreens is not great. We have a lot of legacy code that is really built for mouse interaction, while everywhere people using touch devices.

Supporting touch devices has been tricky because of browser incompatibilities. iD builds on d3 (particularly d3-zoom ) for map interaction, and it works ok, but we need to add a lot of workarounds.

Pointer Events are the more modern and now better supported way of handling user input across different kinds of devices.

More info:
https://medium.com/@wesharehoodies/pointer-events-with-react-the-why-how-what-617a5b51dbb2

There's no rush to switch, but some things to consider:

  • iD currently supports 2 finger panning and pinch-zoom gestures in Chrome, Firefox, Safari (via wheel events)
  • iD does not currently support these gestures in Edge or IE11 (Edge didn't implement the wheel event workaround)
  • caniuse shows Pointer Events are supported in all those browsers, except Safari
    • Safari tech preview supports them as experimental feature, so they are coming eventually
    • Safari supports something called Gesture Events instead, and we handle them already.

Originally posted by @bhousel in #5492 (comment)

@bhousel bhousel added usability An issue with ease-of-use or design touch-stylus An issue with touchscreen or pen input labels Nov 20, 2018
@quincylvania quincylvania added the iD v3 Ideas and issues for the next major iD version label Feb 28, 2020
@quincylvania
Copy link
Collaborator

All major browsers now support pointer events, covering 86% of global users according to caniuse. I imagine it's an even higher percentage of iD users. I think it's time to try making pointer events standard as we work towards better mobile support in v3. We can fallback to the old events for unsupporting browsers.

quincylvania added a commit that referenced this issue Mar 4, 2020
…orms (re: #5505)

Fix issue where Apple Pencil stylus could not select map data (close #7396)
Fix issue where features could not be selected in a single tap on iPad (close #7380)
@quincylvania quincylvania added this to the Next Release milestone Mar 5, 2020
@quincylvania quincylvania self-assigned this Mar 5, 2020
quincylvania added a commit that referenced this issue Mar 5, 2020
Enable dragging nodes with touches and styluses (close #7415)
zlavergne pushed a commit to KaartGroup/iD that referenced this issue Mar 10, 2020
…orms (re: openstreetmap#5505)

Fix issue where Apple Pencil stylus could not select map data (close openstreetmap#7396)
Fix issue where features could not be selected in a single tap on iPad (close openstreetmap#7380)
zlavergne pushed a commit to KaartGroup/iD that referenced this issue Mar 10, 2020
quincylvania added a commit that referenced this issue Mar 25, 2020
)

Properly disable dragging the map under the edit menu for pointer events (re: #5505)
@quincylvania quincylvania modified the milestones: 3.0.0, 2.18.0 May 5, 2020
@quincylvania quincylvania removed the iD v3 Ideas and issues for the next major iD version label May 5, 2020
@quincylvania
Copy link
Collaborator

We've made a lot of progress with this switch! Here are a few things you can now do on touch devices that were impossible or buggy before:

  • Draw ways
  • Drag nodes
  • Double tap to add nodes to ways
  • Select features with one tap
  • Pan and pinch the map on Edge
  • Use styluses
  • Drag to change the imagery offset
  • Resize the photo viewer

While there are still more opportunities to improve touch interactions, I'm considering the meat of this issue complete. Further work can be split into more specific issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
touch-stylus An issue with touchscreen or pen input usability An issue with ease-of-use or design
Projects
None yet
Development

No branches or pull requests

2 participants