This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
In the current spec, the "collect ancestors" function returns a list of documents whose fullscreen element stack consist of one element, and then those documents exit from fullscreen in the last step of exitFullscreen() method. I know it is defined this way so that iframes outside automatically exit when we exit the only fullscreen element in it, just like how they were automatically pushed to the stack. But this could cause undesired problem if author explicitly calls requestFullscreen() on an iframe element, then call the same method on some element inside. For example, if we have tree like: iframe #a | +- div #b and follow the steps: 1. call a.requestFullscreen() 2. call b.requestFullscreen() 3. call a.contentDocument.exitFullscreen() This will cause the fullscreen be fully exited, because the only element in the fullscreen element stack of document inside #a is being popped. This could really surprise author, as they could sometimes want to make iframe itself fullscreen. To fix this issue, I propose we change the first step of requestFullscreen() to: If the context object has nested browsing context, let pending be the documentElement of the nested document, otherwise, let pending be the context object. This could make things a little surprising that calling requestFullscreen() on an iframe then calling exitFullscreen() on its contentDocument could exit fullscreen. But I think it should be fine as it doesn't add much complexity while fixes a more significant undesired behavior.
Is this problem big enough to try fixing? For my own part, if it is fixed, I think it ought to be by having a flag on iframe elements in the top layer stack which means "this was added explicitly, don't exit implicitly".
Xidorn, is Philip's approach okay with you? I'm also not entirely sure this warrants fixing, but I guess it makes the whole setup slightly more consistent.
That approach probably makes the most sense. I don't know whether it is worth solving, but it seems to me Trident does it in a more sensible way than the spec on this issue.
(In reply to Xidorn Quan from comment #3) > That approach probably makes the most sense. I don't know whether it is > worth solving, but it seems to me Trident does it in a more sensible way > than the spec on this issue. Huh, Trident already does something clever here? Better ask them precisely what it is and use that if it's good enough.
I've emailed Ali Alabbas at Microsoft about this.
Hi Xidorn and Philip, I am a dev from Microsoft IE team and now working on fullscreen area. Nice to you meet you guys. Philip’s approach looks good to me. Trident is now doing something very similar to avoid this issue. The explicitly added elements are marked differently in trident. Thanks, Riff
https://github.com/whatwg/fullscreen/commit/079dcf4bacd976359b412522dd8e5f75b7ac4a1e Thanks Riff!
(In reply to Anne from comment #7) > https://github.com/whatwg/fullscreen/commit/ > 079dcf4bacd976359b412522dd8e5f75b7ac4a1e > > Thanks Riff! These changes look good to me. Do they pedantically match the implementation in Edge, Riff? (That would be surprising, but any differences are worth knowing.)
(In reply to Philip Jägenstedt from comment #8) > (In reply to Anne from comment #7) > > https://github.com/whatwg/fullscreen/commit/ > > 079dcf4bacd976359b412522dd8e5f75b7ac4a1e > > > > Thanks Riff! > > These changes look good to me. Do they pedantically match the implementation > in Edge, Riff? (That would be surprising, but any differences are worth > knowing.) Yes, Philip. No surprises here. The way we track the explicitly added elements in Trident and Edge are exactly the same.
So this deals with iframes only. Should also <object> and <frame> be handled the same way (though, <frame> is rather deprecated.) Feels odd if <iframe> and <object> behave differently.
(In reply to Olli Pettay from comment #10) > So this deals with iframes only. Should also <object> and <frame> be handled > the same way (though, <frame> is rather deprecated.) > Feels odd if <iframe> and <object> behave differently. It doesn't seem to me any document inside <frame> or <object> should ever be able to enter fullscreen. According to the spec, an element can enter fullscreen only when its document has "fullscreen enabled flag" set [1], however that flag is only set for the topmost document and document inside <iframe> with allowfullscreen attribute set [2]. [1] https://fullscreen.spec.whatwg.org/#fullscreen-element-ready-check [2] https://fullscreen.spec.whatwg.org/#fullscreen-enabled-flag
(In reply to Xidorn Quan from comment #11) > It doesn't seem to me any document inside <frame> or <object> should ever be > able to enter fullscreen. That is correct, and I've previously even removed some support for <frame> from Blink.