Skip to content

After using the Fullscreen button, HTML5 library full screen functions fail #3283

Description

@dreamlayers

The "Fullscreen" button in the top right corner of Emscripten-generated web pages uses Module.requestFullScreen(), which calls Browser.requestFullScreen(). This adds the fullScreenChange() event listener.

Browser.requestFullScreen() creates a div where canvas used to be, moves canvas into that div, making the div the full screen element. Code in fullScreenChange() is meant to undo this change, by moving canvas to into the parent of its parent.

When SDL 2 calls emscripten_request_fullscreen_strategy() and makes canvas the full screen element, fullScreenChange() code for moving canvas up is inappropriately triggered. The function assumes full screen is being entered only if the parent of canvas is the full screen element, and otherwise assumes full screen being exited and canvas needs to be moved back up to its original location. That exits out of full screen, calling fullScreenChange() again. The end result is canvas replaced body and it's not in full screen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions