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.
The "Fullscreen" button in the top right corner of Emscripten-generated web pages uses
Module.requestFullScreen(), which callsBrowser.requestFullScreen(). This adds thefullScreenChange()event listener.Browser.requestFullScreen()creates adivwherecanvasused to be, movescanvasinto thatdiv, making thedivthe full screen element. Code infullScreenChange()is meant to undo this change, by movingcanvasto into the parent of its parent.When SDL 2 calls
emscripten_request_fullscreen_strategy()and makescanvasthe 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, callingfullScreenChange()again. The end result iscanvasreplacedbodyand it's not in full screen.