Intent to Implement: window.focus() exits HTML5 fullscreen

74 views
Skip to first unread message

Avi Drissman

unread,
Jan 8, 2018, 3:35:24 PM1/8/18
to blink-dev
Contact emails
Summary
If a page calls |window.focus()| on a popup, it is exited from fullscreen.

Motivation
Fullscreen and window focusing do not mix well. Window focusing can interfere with the signals that Chromium uses to tell the user that they are in fullscreen (for those with security privileges, see https://crbug.com/776418).

HTML5 fullscreen is an immersive experience with one window taking over the entire screen. window.focus() is a request to change the focused window. Because they have different goals (immersion vs multi-window operation), this intervention should not affect legitimate sites.

We currently exit fullscreen for JavaScript dialogs and we currently exit fullscreen for popups (this behavior is so old it predates chromestatus.com). This intent is a follow-up to those features.

Compatibility risk
Low. As described, because these two features have two different goals, legitimate sites should not be affected.

Ongoing technical constraints
none

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
No, fullscreen is a desktop-only feature.

Launch tracking bug

Link to entry on the Chrome Platform Status

Requesting approval to ship?
Yes.

Mounir Lamouri

unread,
Jan 9, 2018, 6:44:07 AM1/9/18
to Avi Drissman, blink-dev
On Mon, 8 Jan 2018, at 20:34, Avi Drissman wrote:
> *Contact emails*
> a...@chromium.org
>
> *Spec*
> https://fullscreen.spec.whatwg.org/
>
> *Summary*
> If a page calls |window.focus()| on a popup, it is exited from fullscreen.
>
> *Motivation*
> Fullscreen and window focusing do not mix well. Window focusing can
> interfere with the signals that Chromium uses to tell the user that they
> are in fullscreen (for those with security privileges, see
> https://crbug.com/776418).
>
> HTML5 fullscreen is an immersive experience with one window taking over the
> entire screen. window.focus() is a request to change the focused window.
> Because they have different goals (immersion vs multi-window operation),
> this intervention should not affect legitimate sites.
>
> We currently exit fullscreen for JavaScript dialogs
> <https://www.chromestatus.com/feature/5669548871122944> and we currently
> exit fullscreen for popups (this behavior is so old it predates
> chromestatus.com). This intent is a follow-up to those features.

An obvious alternative would be to ignore the `focus()` call. Do we prefer to instead exit fullscreen for consistency with the dialog/popups behaviour?

> *Compatibility risk*
> Low. As described, because these two features have two different goals,
> legitimate sites should not be affected.

I guess there will be use counters to check this?

> *Will this feature be supported on all six Blink platforms (Windows, Mac,
> Linux, Chrome OS, Android, and Android WebView)?*
> No, fullscreen is a desktop-only feature.

Android and WebView have fullscreen support.

-- Mounir

Avi Drissman

unread,
Jan 9, 2018, 10:50:46 AM1/9/18
to Mounir Lamouri, blink-dev
On Tue, Jan 9, 2018 at 6:44 AM, Mounir Lamouri <mou...@lamouri.fr> wrote:
An obvious alternative would be to ignore the `focus()` call. Do we prefer to instead exit fullscreen for consistency with the dialog/popups behaviour?

Ignoring focus() while in fullscreen? That's also a good idea. I chose exiting fullscreen because I already carved out a line in the fullscreen spec to allow the user agent to have the discretion to drop fullscreen when appropriate, and this would fall within the scope of that clause.

I guess there will be use counters to check this?

The implementation point would be on the Chromium side rather than the Blink side, so it would likely be a UMA measurement, but I'm open to measurement.
 
Android and WebView have fullscreen support.

They do? I wasn't aware of that. This wouldn't be gated on any particular platform; the code would be "if a page focuses while in fullscreen then drop fullscreen". That would have effect on any platform in which that made sense.

I have a preliminary CL at https://crrev.com/c/852378 implementing what I'm proposing, if that helps.

Avi

Avi Drissman

unread,
Jan 12, 2018, 11:57:53 AM1/12/18
to blink-dev
Platform owners: ping.

Marijn Kruisselbrink

unread,
Jan 12, 2018, 12:32:41 PM1/12/18
to Avi Drissman, blink-dev

Requesting approval to ship?
Yes.

If this is actually an intent-to-ship you might want to resend it with the correct subject line? 

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACWgwAab9LL4s82x-30vt%2BTwCfWiaN7_wWw70yLgVfm9gHk-RQ%40mail.gmail.com.

Avi Drissman

unread,
Jan 12, 2018, 12:38:34 PM1/12/18
to Marijn Kruisselbrink, blink-dev
Done.

Mounir Lamouri

unread,
Jan 15, 2018, 7:52:29 AM1/15/18
to Avi Drissman, blink-dev
Thanks for the clarifications Avi. SGTM :)

-- Mounir
> --
> You received this message because you are subscribed to the Google
> Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to blink-dev+...@chromium.org.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACWgwAZZUKuwrJjytW3_QYnq_SisEoTz1mjBfWK%3DKWzFH8g01A%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages