-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix an iOS15 issue where Safari tab bar interrupts panning #11084
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the intention of this.stop()
was to stop gestures because they aren't written to handle resizing which could cause erratic jumps. However, I just tried gestures during a resize and they seem to work well enough with the new gesture implementation (because it's more pixel-based). I used https://github.com/mapbox/mapbox-gl-js/tree/test-gestures-while-resizing to test
The fix looks good to me. I didn't test on iOS 15.
The new unit test looks good, but it might be slightly better to add one that checks that the gesture still works with a resize. Maybe copy one of the touch tests in test/unit/ui/handler/drag_pan.test.js
and throw a resize in there
The minimal page required to test this needs a map and enough content to scroll. This comment contains a sample page which can be dropped into debug/issue-11048.html
|
Here's what it looks like when I rotate the device while panning. Since the map size changes, it jumps a little bit. We could consider transforming coordinates and smoothing this out, but I don't think it's particularly awful since this interaction pattern is probably exceptionally uncommon. I'm definitely okay with this behavior. IMG_0101.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one more situation which causes this bug: when you first navigate to the page and it toggles the tab bar, a blur event is emitted which triggers this line, which interrupts interactions: mapbox-gl-js/src/ui/handler_manager.js Line 348 in c13e5ce
Contemplating if we want to disable or modify this behavior. 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this on Android Firefox, and it fixes a similar but unreported bug that likely occurs in other browsers that show/hide a search bar on swipe. (In Firefox, the issue occurs only when tilting with a two-finger swipe.)
I'm not seeing any issues in Android Chrome.
Great work @mourner and all who are tackling this!
* Move blur event reset into non-touch handlers * Fix linter * Fix/amend unit tests * Flush task queue in rotate test
* fix an iOS15 issue where map stops when panning * fix tests and lint * Test drag pan handler does not end interaction on resize * Move blur event reset into non-touch handlers (#11087) * Move blur event reset into non-touch handlers * Fix linter * Fix/amend unit tests * Flush task queue in rotate test Co-authored-by: Ricky Reusser <ricky.reusser@mapbox.com> Co-authored-by: Ricky Reusser <rreusser@users.noreply.github.com>
…11089) * fix an iOS15 issue where map stops when panning * fix tests and lint * Test drag pan handler does not end interaction on resize * Move blur event reset into non-touch handlers (#11087) * Move blur event reset into non-touch handlers * Fix linter * Fix/amend unit tests * Flush task queue in rotate test Co-authored-by: Ricky Reusser <ricky.reusser@mapbox.com> Co-authored-by: Ricky Reusser <rreusser@users.noreply.github.com> Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
…11089) * fix an iOS15 issue where map stops when panning * fix tests and lint * Test drag pan handler does not end interaction on resize * Move blur event reset into non-touch handlers (#11087) * Move blur event reset into non-touch handlers * Fix linter * Fix/amend unit tests * Flush task queue in rotate test Co-authored-by: Ricky Reusser <ricky.reusser@mapbox.com> Co-authored-by: Ricky Reusser <rreusser@users.noreply.github.com> Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
…11101) * Fix an iOS15 issue where Safari tab bar interrupts panning (#11084) (#11089) * fix an iOS15 issue where map stops when panning * fix tests and lint * Test drag pan handler does not end interaction on resize * Move blur event reset into non-touch handlers (#11087) * Move blur event reset into non-touch handlers * Fix linter * Fix/amend unit tests * Flush task queue in rotate test Co-authored-by: Ricky Reusser <ricky.reusser@mapbox.com> Co-authored-by: Ricky Reusser <rreusser@users.noreply.github.com> Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com> * Removed getBoundingClientRect conflict for unit tests * Added offsetHeight to replace getBoundingClientRect to fix unit tests * add clientWidth and clientHeight to unit tests * container -> map.getContainer() * Replaced offsetWidth with clientWidth * removing change difference in attribution and logo unit tests from v1.13.2 * Change size of container instead of canvas container to trigger resize in unit tests * Added change in height to trigger resize * fix to attribution.test.js * Fixes logo.test.js to pass * removed unneeded changes Co-authored-by: Ricky Reusser <rreusser@users.noreply.github.com> Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
* main: Add touch pan blocker to gesture handling for touch devices (#11116) Address accessibility issues (#11064) add support for non-mercator projections (#11124) Image fallback expressions within paint properties (#11049) Replaces EPSG:4326 with OGC:CRS84 in GL JS `LngLat` doc (#11072) Add globe view support to heatmap shaders (#11120) Exclude flaky test (#11118) consistify YOUR_MAPBOX_ACCESS_TOKEN as placeholder string (#11113) Allow adding multiple layers to `map.on()` event handler (h/t @omerbn) (#11114) render-test-flakiness:clear worker storage (#11111) upgrade to supercluster v7.1.4, earcut v2.2.3, vt-pbf v3.1.3, geojson-rewind v0.5.1 (#11110) Added v1.13.2 changelog entry (#11108) One weird JSON.parse() trick (#11098) Fixed doc usage of map.getCenter (#11093) s̶y̶m̶b̶o̶l̶-̶c̶l̶i̶p̶ dynamic-filtering with `pitch` and `distance-from-camera` expressions (#10795) Update link to transpiling guide (#11096) Cherry pick 2.5.1 changelog (#11099) Fix an iOS15 issue where Safari tab bar interrupts panning (#11084) Fix conditional check for isFullscreen to accommodate Safari (#11086) Render tests for #11041 (#11070)
Tentatively closes #11048 (an issue on iOS where the iOS Safari tab bar interrupts panning):
stop
onmap.resize
(originally introduced in gesture handling refactor #9365).resize
do nothing if the container size didn't change (not necessary for the fix but felt like the right thing to do).Launch Checklist
mapbox-gl-js
changelog:<changelog>Fix an iOS15 issue where Safari tab bar interrupts panning</changelog>