Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ALT + TAB Never fires keyup event for ALT so ALT is then treated as being held down. #890

Closed
Dastari opened this issue Dec 28, 2022 · 2 comments · Fixed by #892
Closed

Comments

@Dastari
Copy link

Dastari commented Dec 28, 2022

Describe the bug
When you Alt+Tab out of the window and back in again, the Alt key is still considered as being held down as the browser never fires the key up event.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Sandbox Below
  2. Click on Button to check if Alt is down (Should be No)
  3. Alt+Tab out of the Window then back into it
  4. Click on Button to check if Alt is down (Should be Yes)

https://codesandbox.io/s/funny-christian-3tqoro?file=/src/App.js

Expected behavior
When browser window returns to focus only keys that are actually held down should act as if they are being held down.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Edge (Chromium)
  • Version: 108.0.1462.54 (Official build) (64-bit)

Additional context
I haven't done a PR yet however I believe the fix is to add an additional handler "window.addEventListener('blur', keyUpHandler) wherever the document.addEventListener('keuUp', keyUpHandler) is called.

@JohannesKlauss
Copy link
Owner

Thanks for raising that issue. I'll have a look into it

@JohannesKlauss
Copy link
Owner

Fixed in 4.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants