fullscreen
fullscreen copied to clipboard
Deny request on invisible document
I think we should instead invoke https://w3c.github.io/page-visibility/#dfn-steps-to-determine-the-visibility-state directly.
IDL attributes is generally what is exposed to JavaScript, whereas specification algorithms should operate on what is exposed to IDL. You can contrast this with C++, where we'd also generally use some underlying concept.
Also, I'd like @foolip to sign off on the general idea.
Can you confirm that the document.hidden
attribute actually true false for background windows? I assumed that would require involving the window manager some how, and that as actually implemented it only returns true for background tabs.
It returns false
for background window, but true
for background tab. It seems in Chrome, background tab wouldn't be allowed to enter fullscreen either, how does that work?
We stop background window from entering fullscreen via detecting whether the document has focus, I think. Chrome seems to allow background window to enter fullscreen. Do we want to add the focus check to the element ready check instead?
Is the example in https://github.com/whatwg/fullscreen/issues/58#issuecomment-250416978 the only thing that this is supposed to prevent? In my testing, the newly opened window is not hidden, which I think matches your testing.
Presumably it's easy to also give the new window focus, but is the goal to prevent all new windows from going fullscreen, or just some cases?
I think the goal is to prevent a background window from going fullscreen silently, so probably we want to check whether the document or the top browsing context of document currently has focus.
Can you test if document.activeElement
becomes null in non-active windows, and if there are any events fired? Given http://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active I wouldn't be surprised if there's no web exposed API to tell the difference.
Ping @upsuper
document.activeElement
doesn't become null. focus
and blur
would be fired when switching between windows, but changing the focus to address bar also triggers blur
.
If it is not allowed to trigger fullscreen asynchronously, the top level document should always get focused before requestFullscreen
is called, unless a document from another window requests that.
So should we allow a foreground document to put a background document into fullscreen? Given that window cannot raise itself in general, I don't see how allowing that could be useful.
So should we allow a foreground document to put a background document into fullscreen? Given that window cannot raise itself in general, I don't see how allowing that could be useful.
I agree that doesn't sound useful. What should the spec say to prevent that? One thing that might work is a document-bound user gesture concept, so that it's only possible to request fullscreen for the document that was clicked. Is that what you had in mind?