Wake Lock releases when app is not visible. This is expected and is same in all platforms (iOS, Android, Windows) document.visibilitychange event is used to aquire wake lock after user has started using app again. In iOS Wake Lock does not work after "visibilitychange" event to re-aquire wake lock if user *goes to home screen*. If apps are changed *without going to home screen*, then wake lock is re-aquired or stays active. Error message: NotAllowedError: Permission was denied Expected result: There should be permission to re-aquire wake lock after going back to home screen & back to Safari. There are no permission errors in Android or Windows. Example: https://mdn.github.io/dom-examples/screen-wake-lock-api/ Code: https://github.com/mdn/dom-examples/blob/main/screen-wake-lock-api/script.js
<rdar://problem/108279602>
This is because we require transient activation to request the wake lock. When you're calling request() from the visibility change handler, you don't have transient activation.
Pull request: https://github.com/WebKit/WebKit/pull/13104
Committed 263382@main (d901ad78bdb6): <https://commits.webkit.org/263382@main> Reviewed commits have been landed. Closing PR #13104 and removing active labels.