Bug 19917 - Split fullscreenchange event into two separate events
Summary: Split fullscreenchange event into two separate events
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Fullscreen (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2012-11-09 08:52 UTC by Hao Jing
Modified: 2012-11-09 18:44 UTC (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Hao Jing 2012-11-09 08:52:59 UTC
We have defined fullscreenchange event to capture the change of fullscreen (http://www.w3.org/TR/fullscreen/), but in some cases web app needs to know if the document is entering fullscreen or exiting fullscreen. For example, the web app wants to do some operation such as hide some elements or pop up an alert dialog to user when the document is exiting fullscreen , but only applying fullscreenchange event cannot make the app to be sure the document is exiting fullscreen unless web developer provide a trick, such as set a flag to mark the document's status(in fullscreen or out of fullscreen).

Therefore, can we split the "fullscreenchange" event to two separate events? One is "fullscreenenter" event which will be invoked when the document is entering fullscreen, another is "fullscreenexit" event which will be invoked when the document is exiting fullscreen. With those two events web developer can create app easily to distinguish condition of entering or exiting fullscreen.
Comment 1 Olli Pettay 2012-11-09 08:57:56 UTC
for the reference, latest spec is in http://fullscreen.spec.whatwg.org/
Comment 2 Hao Jing 2012-11-09 09:08:04 UTC
Thanks Olli,I review the spec you provide, there is still one fullscreenchange event,no new event is defined.
Comment 3 Olli Pettay 2012-11-09 09:18:31 UTC
yup, though I wonder why .fullscreenElement isn't enough for your use case.
Comment 4 Anne 2012-11-09 09:33:15 UTC
Yes, fullscreenElement is meant to address this.
Comment 5 Chris Pearce 2012-11-09 18:44:34 UTC
When you receive a "fullscreenchange" event, check document.fullscreenElement, If it's non-null, the user is in fullscreen mode. If it's null, the user has exited fullscreen. Is that sufficient for your needs?