fullscreen icon indicating copy to clipboard operation
fullscreen copied to clipboard

Exit fullscreen on document with multiple subdocument in fullscreen

Open upsuper opened this issue 10 years ago • 8 comments
trafficstars

Assuming we have tree like:

body (document)
|
+- iframe #fa
|  |
|  +- div #a
|
+- iframe #fb
   |
   +- div #b

If we do:

  1. a.requestFullscreen()
  2. b.requestFullscreen()
  3. document.exitFullscreen()

According to the current spec, it seems the result is:

  • the content documents of both iframes exit fullscreen
  • the current fullscreen element of the document becomes iframe #fa

This doesn't seem to be correct. I think only the content document of #fb should exit fullscreen.

I suggest moving the unfullscreen descendant document steps into unfullscreen an element.

upsuper avatar Oct 20 '15 03:10 upsuper

It looks like because "collecting documents to unfullscreen" returns an empty set, we will fully exit fullscreen in step 9.2. Is that where the problem is?

foolip avatar Oct 20 '15 07:10 foolip

No. In that case, resize is false, so it won't fully exit fullscreen in that step.

upsuper avatar Oct 20 '15 08:10 upsuper

Oh, right you are. So at step 9.4, resize will be false and exitDocs will consist of only doc itself. I suppose things start to go wrong at step 9.5, where all descendant documents are collected instead of just the ones in exitDocs.

Both unfullscreen an element and unfullscreen a document are low-level operations, so if there's a fix for this that would be contained inside the definition of exit fullscreen, that would be nice.

foolip avatar Oct 20 '15 08:10 foolip

The issue is that, we may also need that in the removing steps. If we replace step 3 with body.removeChild(fa), should the inner document exit fullscreen? Maybe that could happen via some other mechanism, though.

upsuper avatar Oct 20 '15 08:10 upsuper

Yeah, it does look like the removing steps can end up simply calling unfullscreen node for iframes whose content document has a fullscreen element. That looks like an unrelated bug, though, probably those steps worked when fullscreen element stack had to be in tree order?

foolip avatar Oct 20 '15 09:10 foolip

Yeah, it worked before, because iframe if any may only be the top in the fullscreen element stack.

I think those steps should be moved to unfullscreen node because descendent document is part of iframe elements, and thus whenever you unfullscreen the element, its inner document should always get unfullscreened as well, no?

upsuper avatar Oct 20 '15 09:10 upsuper

Yeah, that has a certain appeal, as long as making this recursive doesn't make it harder to fire all of the events at the end of exit fullscreen.

foolip avatar Oct 20 '15 09:10 foolip

Ahh... you're right... Then they are two different issues...

upsuper avatar Oct 20 '15 09:10 upsuper