- From: Philip Jägenstedt <notifications@github.com>
- Date: Tue, 02 May 2023 09:02:37 -0700
- To: whatwg/fullscreen <fullscreen@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/fullscreen/pull/223/c1531730959@github.com>
To help decide on the flip-flop case I checked how `<dialog>` behaves with this test:
```html
<dialog id="A" style="background-color:lavender">
<span>This is A. <button onclick="show(event)">open/toggle dialog</button></span>
</dialog>
<dialog id="B" style="background-color: lemonchiffon">
<span>This is B. <button onclick="show(event)">open/toggle dialog</button></span>
</dialog>
<button onclick="show(event)">open/toggle dialog</button>
<script>
const dialogs = Array.from(document.querySelectorAll('dialog'));
function show(event) {
let dialog = dialogs.find((dialog) => !dialog.open);
if (!dialog) {
// Try to open the first one anyway, expect it to fail.
dialog = dialogs[0];
}
console.log(`Showing dialog ${dialog.id}`);
try {
dialog.showModal();
console.log(`Success for ${dialog.id}`);
} catch (error) {
console.log(`Error for ${dialog.id}: ${error.message}`);
}
}
</script>
```
These are sibling `<dialog>` elements. Chrome, Firefox and Safari all open A and then B, but won't open A again because it's already open.
To get the equivalent behavior for the fullscreen API, we should reject if the element is already in top layer stack, but we _shouldn't_ add back a hierarchy restriction.
@josepharhar @mfreed7 would that work for you?
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fullscreen/pull/223#issuecomment-1531730959
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/fullscreen/pull/223/c1531730959@github.com>
Received on Tuesday, 2 May 2023 16:02:42 UTC