- From: Philip Jägenstedt <notifications@github.com>
- Date: Wed, 03 May 2023 01:14:42 -0700
- To: whatwg/fullscreen <fullscreen@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fullscreen/pull/223/c1532621888@github.com>
@mfreed7 sounds good! Let's hammer out the details of point 2 then, what happens for a second call to `elm.requestFullscreen()` in different scenarios. Bottom line first: no-op success when requesting fullscreen again matches current behavior. That's what this PR already does, so no changes required. The investigation: **One scenario** is calling `requestFullscreen()` twice in the same click event handler: ```js button.onclick = () => { const p1 = div.requestFullscreen(); const p2 = div.requestFullscreen(); // Does p2 reject and why? } ``` This is tested in [element-request-fullscreen-twice.html](https://wpt.fyi/results/fullscreen/api/element-request-fullscreen-twice.html) and Chrome, Firefox and Safari all reject the second promise. Per spec (with https://github.com/whatwg/fullscreen/pull/153 just merged) it should reject because the user gesture was consumed by the first call. **Another scenario** is calling `requestFullscreen()` on the element that's already fullscreen, in a second click event handler: ```js button.onclick = () => { const p = div.requestFullscreen(); // Does p reject if div is document.fullscreenElement? } ``` This is tested in [element-request-fullscreen-same-element.html](https://wpt.fyi/results/fullscreen/api/element-request-fullscreen-same-element.html). That times out in Safari, I don't know why, so I tested this manually: ```html button.onclick = () => { if (!document.fullscreenElement) { div.requestFullscreen().then(() => { console.log('1st request succeeded'); }, (error) => { console.log('1st request failed:', error.message); }); } else { div.requestFullscreen().then(() => { console.log('2nd request succeeded'); }, (error) => { console.log('2nd request failed:', error.message); }); } } ``` I've found that Chrome, Firefox and Safari all resolve the 2nd promise, in other words it's a no-op. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fullscreen/pull/223#issuecomment-1532621888 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fullscreen/pull/223/c1532621888@github.com>
Received on Wednesday, 3 May 2023 08:14:47 UTC