Skip to content

Calling GLFW.setWindowSize with the screen size leads to browser error #20600

@ypujante

Description

@ypujante

This issue is created from the PR Review.

The code at issue is:

        if (width == screen.width && height == screen.height) {
          Browser.requestFullscreen();
        } else { // ...

When the calling code calls GLFW.setWindowSize and provides width and height to be the screen width and height, it ends up calling Browser.requestFullscreen. Unfortunately, this raises this error: Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture.

When Browser.requestFullscreen is called when a user clicks on a button (for example in the default shell), this works. But when it is called directly it fails.

As requested in the PR, I am reverting the changes I made in the PR and I create a separate issue for it.

I will then make another PR for this problem only, which should also allow me to write a test unique to this error.

Of note: there is another piece of code that does a similar call on window creation and I bet it triggers the same issue. I will also add a test for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions