Hotkeys not working after triggering print dialog
Author: trygve-aaberge-adskCreated Feb 19, 2025Updated Sep 1, 2025
If you trigger the print dialog from a shortcut, the keyup listener for that shortcut will never be triggered. That causes all other shortcuts to stop working because it thinks the key pressed for the print dialog is still being held down.
This happens at least in Chrome 133.0.6943.35. In Firefox 134.0.2 it sends the window focus event when the print dialog is dismissed, which makes it reset the key state, so it doesn't happen there.
Here's some code to reproduce it: https://codepen.io/trygveaa/pen/gbOPwrv
Press a and see that the press and release handlers are working. Then press ctrl+p and you will get the print dialog. Close it and press a again and see that no handlers are called.
Source: jaywcjlove/hotkeys-js