MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Inconsistent user gesture requirement for requestFullscreen()

Open
#944 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description
WebView2 appears to relax most user gesture requirements imposed on the web, such as allowing audio playback on startup. This is a nice feature of WebView2, especially since often these restrictions make sense on the web, but not in an app.

I've noticed the user gesture requirement for requestFullscreen() seems inconsistent. It looks like the call is still blocked if you did not yet click in the app. If you did focus the app already, the API can then be called at any time. It should be allowed at any time, even before clicking in the app, so you can get a fullscreen-on-startup experience (especially relevant to web games).

Version
SDK: 1.0.705.50
Runtime: 88.0.705.68 stable
Framework: Win32
OS: Windows 10 x64 version 20H2

Repro Steps
Demo app: requestfullscreentest.zip

  1. Launch the app but don't interact with it.
  2. After the splash screen has finished and a simple shooter game is running, press F12.
  3. Check the browser console: a call to requestFullscreen failed with Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture.

Try again but click in the middle of the splash screen while it is showing. When the splash screen finishes, it enters fullscreen mode successfully.

Additional context
We could code the app to enter fullscreen on startup, but this is not web compatible, since the JavaScript code won't think it's in fullscreen mode. It would be best if WebView2 just allowed calls to requestFullscreen at any time.

AB#31758227

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked requestfullscreentest.zip demo and compare requestFullscreen() before and after clicking the splash screen. Confirm the current gesture-dependent behavior and define completion as allowing the call before interaction while keeping the JavaScript fullscreen state consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
desktop, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.