webvr-ui icon indicating copy to clipboard operation
webvr-ui copied to clipboard

error when entering fullscreen

Open halvves opened this issue 8 years ago • 0 comments

In Firefox and Chrome latest I get the following error when entering fullscreen:

TypeError: e.manager.enterFullscreen(...).then is not a function

Note that the browser still successfully enters fullscreen (which, while Chrome always worked, Firefox didn't use to work on previous versions of webvr-ui).

The error sees to come from /src/enter-vr-button.js#L240. It looks like the code is attempting to use this.manager.enterFullscreen() as though it were a promise (trying to .then() on it).

I can avoid the error for now by supplying a bogus beforeEnter() to options to have the logic take the path of /src/enter-vr-button.js#L234.

Another interesting observation related to #5:

  • When not wrapped in a promise (when it takes the path that gives us the original console error: /src/enter-vr-button.js#L239), Firefox successfully enters fullscreen.
  • When using the workaround mentioned above (dummy beforeEnter() to force the working Promise section (no console errors), Firefox throws the ol:

Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler.

warning and won't enter fullscreen.

halvves avatar Oct 10 '17 06:10 halvves