Skip to content

Commit

Permalink
fix(useFullscreen): handle Safari iOS (#2822)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
ferferga and antfu committed Mar 14, 2023
1 parent a3e9547 commit 9d39495
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/core/useFullscreen/index.ts
Expand Up @@ -37,6 +37,15 @@ const functionsMap: FunctionMap[] = [
'webkitfullscreenchange',
'webkitfullscreenerror',
],
// Safari iOS WebKit
[
'webkitEnterFullscreen',
'webkitExitFullscreen',
'webkitFullscreenElement',
'webkitFullscreenEnabled',
'webkitfullscreenchange',
'webkitfullscreenerror',
],
// Old WebKit
[
'webkitRequestFullScreen',
Expand Down Expand Up @@ -94,8 +103,10 @@ export function useFullscreen(
return false
}
else {
const target = unrefElement(targetRef)

for (const m of functionsMap) {
if (m[1] in document) {
if (m[1] in document || (target && m[0] in target)) {
map = m
return true
}
Expand Down

0 comments on commit 9d39495

Please sign in to comment.