ios: dragging=false but scrolling on map not possible
See original GitHub issueHow to reproduce
- Leaflet version I’m using: 1.0.3
- Browser (with version) I’m using: Safari/602.1
- OS/Platform (with version) I’m using: iOS 10
What behaviour I’m expecting and which behaviour I’m seeing
When dragging
is disabled, i expect the page to scroll when i drag over the map on ios. instead, nothing happens. on android i can scroll by dragging if dragging=false.
Minimal example reproducing the issue
On ios, it’s not possible to scroll the page when dragging on the map:
https://jsfiddle.net/geg8yLe3/
This is similar to #5343
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:20 (5 by maintainers)
Top Results From Across the Web
DragGesture + ScrollView = problem… - Apple Developer
When placing a DragGesture on a view containing a ScrollView, dragging within the ScrollView causes onChanged to trigger, while onEnded does not trigger....
Read more >How to prevent scroll wheel on mobile but drag the map when ...
I'm using a full width map with Google Maps Api, to prevent the scroll wheel on Desktop I've add the property: scrollwheel:false ....
Read more >Can't continue scrolling on mobile devices when a map ...
var map = L.map('map', {dragging: false}).setView(center, 3);. But option 3 will always disable it. That might not always be desired.
Read more >Maps JavaScript API Release Notes - Google Developers
Maps JS API no longer considers US as a default region in Geocoder if it's not ... Versions 3.49 and 3.48 are still...
Read more >touch-action - CSS: Cascading Style Sheets - MDN Web Docs
Note: After a gesture starts, changes to touch-action will not have ... Note that scrolling "up" (pan-up) means that the user is dragging...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm that the following code seems to be a valid workaround for ensuring that a single finger scrolls the page and not the map, while still allowing for two-finger zoom+pan of the map, as well as tapping on markers. This improves usability on mobile when a map is a part of a larger page that requires scrolling.
Confirmed in iOS 10 Safari and Chrome. Not yet fully tested on Android.
@herrernst huh, nice analysis! Thanks!
It is definitely the tap handler that causes this. Looking at the test code we used in #4051, we actually had
tap: false
.So, for now, the workaround is to not only set
dragging: false
but alsotap: false
to achieve desired behavior.I’ve submitted #5670 in an attempt to address this, so that we do not
preventDefault
for the source of a simulated event unless there is handler for the simulated event.