-
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
Disables cooperative gestures when map is fullscreen in Safari #11619
Conversation
src/ui/handler/scroll_zoom.js
Outdated
@@ -398,6 +398,7 @@ class ScrollZoomHandler { | |||
} | |||
|
|||
_isFullscreen(): boolean { | |||
if (isSafari(window)) return !!window.document.webkitFullscreenElement; |
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.
nit: This looks like it should work fine, but it might be a tiny bit cleaner to remove isSafari(...)
and just always check for webkitFullScreenElement
:
return !!window.document.fullscreenElement || !!window.document.webkitFullscreenElement
.
src/ui/handler/scroll_zoom.js
Outdated
@@ -3,7 +3,7 @@ | |||
import assert from 'assert'; | |||
import * as DOM from '../../util/dom.js'; | |||
|
|||
import {ease as _ease, bindAll, bezier} from '../../util/util.js'; | |||
import {ease as _ease, bindAll, bezier, isSafari} from '../../util/util.js'; |
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.
isSafari is unused now which is causing a lint error
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.
Looks good to merge once lint passes!
* Fix fullscreen bug in Safari and add unit test
…x#11619) * Fix fullscreen bug in Safari and add unit test
Closes #11607. When a map is full screen, cooperative gestures should be disabled - this is more user-friendly as the presumption is that the user will want to only interact with the fullscreen map (e.g. not scroll to other content on the screen). This is expected behavior and works in other browsers. Recently discovered while testing Safari 15.4 that cooperative gestures continued to be enabled when map is fullscreen. It was believed that this was working prior (see PR #11086), but is also not working in 15.3.
Added unit test that mocks fullscreenElement, doesn't necessarily address this problem with safari but was a previously missing unit test that checks scroll zoom happens when map is full screen.
Launch Checklist
mapbox-gl-js
changelog:<changelog>Fixes disabling cooperative gestures when map is fullscreen in Safari.</changelog>