AncientBeast icon indicating copy to clipboard operation
AncientBeast copied to clipboard

Fullscreen Toggle Issue in Firefox (F11)

Open hedi30 opened this issue 8 months ago • 6 comments

Bug Report: [Fullscreen Toggle Issue in Firefox]

https://github.com/user-attachments/assets/fa6347ea-f06b-4bbc-a457-2a4526da56f5

Description

When toggling fullscreen mode using F11 in Firefox, subsequent attempts to enter fullscreen after exiting result in an error. The workaround is to click on the game before pressing F11 again. Shift+f works consistently without issues.

Steps to Reproduce

  1. Open the application in Firefox
  2. Press F11 to enter fullscreen mode
  3. Press F11 to exit fullscreen mode
  4. Press F11 again to attempt re-entering fullscreen
  5. Observe the error in console

Expected Behavior

Fullscreen mode should toggle on/off consistently with each F11 press.

Actual Behavior

After exiting fullscreen, attempting to re-enter fullscreen with F11 produces the following error:

Request for fullscreen was denied because Element.requestFullscreen() was not called from inside a short running user-generated event handler. fullscreen.ts:22:23
Error toggling fullscreen: TypeError: Fullscreen request denied
toggle fullscreen.ts:22
keyDownAction script.ts:127
ts script.ts:158
jQuery 2
fullscreen.ts:28:11
Phaser.ScaleManager: requestFullscreen failed or device does not support the Fullscreen API

Workaround

  1. After exiting fullscreen, click on the game window
  2. Then press F11 - this successfully enters fullscreen mode
  3. Alternatively, Shift+F works consistently without needing to click first

Additional Information

  • Browser: Firefox (version 137.0.2)
  • OS: [Arch Linux]
  • Screen recording available demonstrating the issue

hedi30 avatar Apr 28 '25 14:04 hedi30

I've tried it in Firefox 137.0.2 (64-bit) on Kubuntu and I can't reproduce it. What about the one here? -> https://beta.ancientbeast.com any issues?

DreadKnight avatar Apr 28 '25 19:04 DreadKnight

for that build issue #2690 isn't fixed also it's kinda worse since f11 doesn't work in game at all , review https://github.com/FreezingMoon/AncientBeast/pull/2715#issuecomment-2835366012 using chrome based browser and firefox

hedi30 avatar Apr 28 '25 19:04 hedi30

@DreadKnight i'll try to reproduce this issue and will work on it

yousefsassy avatar Apr 28 '25 20:04 yousefsassy

@yousefsassy Alright, assigned you to it!

DreadKnight avatar Apr 28 '25 21:04 DreadKnight

@DreadKnight i've tried to reproduce the issue on my mac but it seems that macs dont accept f11 button so i can't really test this issue so if @hedi30 fixed it on linux then it should be good to close this issue 🐻

yousefsassy avatar May 13 '25 19:05 yousefsassy

Just to add on:

I have tested this on my windows computer and after some research it seems that this is a security decision made by firefox. For the requestFullscreen() method to work user interaction is needed and also the key pressed has to not be reserved by the browser. Refer to the security section of https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen#security

The F11 key is a reserved key and it's also another reason why I think it doesn't work as well as pressing shift+F. My only question is why it works the first time when a user presses it. Maybe someone more experienced in this can assist in this issue

Source: https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen#security https://bugzilla.mozilla.org/show_bug.cgi?id=1411227 https://www.reddit.com/r/firefox/comments/1le9vzv/how_do_i_trigger_fullscreen_with_javascript/

Matt-Foo-SL avatar Jul 02 '25 04:07 Matt-Foo-SL