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

fix: wrong focus when hotkey is an empty array #2491

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

m-shaka
Copy link
Contributor

@m-shaka m-shaka commented Oct 29, 2023

Description

When passing an empty array to 'hotkey', Toast.Viewport will be focused regardless of which key is pressed.
This is because Array.prototype.every returns true if the array is empty.

Here's a reproduction. You can't edit the input field since any key press causes focus on the toast, whether it's open or closed.
https://codesandbox.io/s/elastic-cache-zhwsl5?file=/src/App.js

@chaance chaance merged commit 6ac3863 into radix-ui:main Sep 26, 2024
1 of 3 checks passed
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 this pull request may close these issues.

2 participants