map.on() and passive: false events
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**mapbox-gl-js version**: 0.45.0
**browser**: iOS 11.3
### Steps to Trigger Behavior
1. create a map with touchZoomRotate: false
2. add an event handler to a `passive: false` event, like `touchmove` which calls `e.preventDefault()`
3. try touch-zooming, the browser viewport will zoom
### Link to Demonstration
full screen: https://03qo50z3rw.codesandbox.io/
https://codesandbox.io/s/03qo50z3rw
### Expected Behavior
`e.preventDefault()` should disable browser viewport zooming
### Actual Behavior
The browser window zooms, even with `e.preventDefault()`
I tried an alternative, `e.originalEvent.preventDefault()` which seems to work, however the official drag point example uses `e.preventDefault()`.
cc: @jfirebaugh
ref: https://github.com/mapbox/mapbox-gl-js/issues/6095
pr: https://github.com/mapbox/mapbox-gl-js/pull/6248
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the linked CodeSandbox using map.on(), touchZoomRotate: false, and a passive: false touchmove handler. Review the related issue #6095 and pull request #6248, then trace the event path needed for e.preventDefault() to stop viewport zooming; done means the documented handler behaves as expected on iOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100