- From: Philip Jägenstedt <notifications@github.com>
- Date: Wed, 26 Apr 2023 00:35:45 -0700
- To: whatwg/fullscreen <fullscreen@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fullscreen/pull/223/c1522928629@github.com>
OK, I've tested the `A.rFS(); B.rFS(); A.rFS();` scenario with this test case: ```html <style> div { padding: 1em; display: grid; place-items: center; } </style> <div id="A" style="background-color:lavender"> <span>This is A. <button onclick="fs(event)">go/toggle fullscreen</button></span> </div> <div id="B" style="background-color: lemonchiffon"> <span>This is B. <button onclick="fs(event)">go/toggle fullscreen</button></span> </div> <script> const divs = Array.from(document.querySelectorAll('div')); function fs(event) { let target = event.target.closest('div'); if (target === document.fullscreenElement) { // Toggle between the two divs when already fullscreen. target = divs.find((div) => div !== document.fullscreenElement); } console.log(`Requesting fullscreen for ${target.id}`); target.requestFullscreen().then(() => { console.log(`Success for ${target.id}`); }, (error) => { console.log(`Error for ${target.id}: ${error.message}`); }); } </script> ``` As it turns out, only Chrome supports toggling between fullscreen elements like this. Firefox fails the toggle request with "Request for fullscreen was denied because requesting element is not a descendant of the current fullscreen element." Safari also rejects the `requestFullscreen()` call, without a message, but it must be this descendant check in the source: https://github.com/WebKit/WebKit/blob/f462028e09b021b5d2768fee9ea0ffc056565b94/Source/WebCore/dom/FullscreenManager.cpp#L224-L230 In other words, the original hierarchy restrictions are still in Gecko and WebKit, see https://github.com/whatwg/fullscreen/issues/140 for further links. @josepharhar @mfreed7 do you have preferences on how we handle this? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fullscreen/pull/223#issuecomment-1522928629 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fullscreen/pull/223/c1522928629@github.com>
Received on Wednesday, 26 April 2023 07:35:52 UTC