tinypilot icon indicating copy to clipboard operation
tinypilot copied to clipboard

In fullscreen mode, escape key exits fullscreen mode

Open mtlynch opened this issue 4 years ago • 3 comments

Description

A user reported that hitting the escape key while in fullscreen mode causes fullscreen mode to turn off rather than just forwarding the key to the target machine as an "Escape" key.

What's the behavior that you expect?

TinyPilot forwards the escape key to the target machine and remains in fullscreen mode.

What's happening instead?

Hitting the "Escape" key causes TinyPilot to exit fullscreen mode.

What are the steps to reproduce this behavior?

  1. Open TinyPilot in Chrome
  2. Click on Commands > Fullscreen
  3. Hit "Escape"

mtlynch avatar Feb 18 '21 20:02 mtlynch

One consideration here is how users exit fullscreen if we start absorbing the Escape key. Escape works cross-browser, so if we take that away, it might become hard to explain to users how to exit fullscreen.

Maybe we should treat two consecutive Escapes as "real" exit fullscreen.

mtlynch avatar Feb 26 '21 18:02 mtlynch

Here is a work around but... This solution will not work with every browser and it does not seem to work on non-secure sites.

Below is a detailed explanation of a work around which would require holding down ESC to exit full screen.

image

https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock

https://wicg.github.io/keyboard-lock/#escape-key

# Lock keyboard and go full screen
navigator.keyboard.lock();
document.documentElement.requestFullscreen();
# Exit full screen and unlock keyboard.
document.exitFullscreen();
navigator.keyboard.unlock();

image

  • attempted to test on Chrome 96.0.4664.110 on a non secure TinyPilot. navigator.keyboard was undefined.

djclueless avatar Dec 29 '21 13:12 djclueless

Thanks for investigating this! The keyboard.lock feels a bit too brittle at this point. It's strange that it doesn't work under HTTPS, since they don't seem to document that.

mtlynch avatar Dec 29 '21 18:12 mtlynch