Skip to content

Commit

Permalink
Disables cooperative gestures when map is fullscreen in Safari (#11619)
Browse files Browse the repository at this point in the history
* Fix fullscreen bug in Safari and add unit test
  • Loading branch information
avpeery authored Mar 18, 2022
1 parent 7e22ebf commit 0f558b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/handler/scroll_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class ScrollZoomHandler {
}

_isFullscreen(): boolean {
return !!window.document.fullscreenElement;
return !!window.document.fullscreenElement || !!window.document.webkitFullscreenElement;
}

_showBlockerAlert() {
Expand Down
14 changes: 14 additions & 0 deletions test/unit/ui/handler/scroll_zoom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,20 @@ test('When cooperativeGestures option is set to true, scroll zoom is activated w
t.end();
});

test('When cooperativeGestures option is set to true, scroll zoom is not prevented when map is fullscreen', (t) => {
window.document.fullscreenElement = true;
const map = createMapWithCooperativeGestures(t);

const zoomSpy = t.spy();
map.on('zoom', zoomSpy);

simulate.wheel(map.getCanvas(), {type: 'wheel', deltaY: -simulate.magicWheelZoomDelta});
map._renderTaskQueue.run();

t.equal(zoomSpy.callCount, 1);
t.end();
});

test('Disabling scrollZoom removes scroll zoom blocker container', (t) => {
const map = createMapWithCooperativeGestures(t);

Expand Down

0 comments on commit 0f558b3

Please sign in to comment.