-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(select): add Enter keypress to dismiss #30622
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
base: main
Are you sure you want to change the base?
fix(select): add Enter keypress to dismiss #30622
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix and tests! It looks like this doesn't work to select the value using Enter
and there is also an issue where the modal immediately closes when you use Enter
to open it after selecting something:
modal.mov
This also happens on the Popover example.
I think we need to add something like this to onKeyDown
in radio-group
to capture the value:
// Handle Enter key for select interfaces
if (['Enter'].includes(ev.key) && inSelectInterface) {
const previousValue = this.value;
this.value = current.value;
if (previousValue !== this.value) {
this.emitValueChange(ev);
}
ev.preventDefault();
}
But I'm not sure how to fix the other problem right now.
@brandyscarney, sorry for the late response. The immediate close happens because the modal opens on keydown with |
@haryopba Thank you for taking another look! I considered using holding-enter.movI think we'll need to find another solution. 🤔 |
Issue number: resolves #30561
What is the current behavior?
Pressing
Enter
does not dismiss modal or popover inselect-modal
orselect-popover
What is the new behavior?
Enter
dismisses modal or popover inselect-modal
orselect-popover
Does this introduce a breaking change?
Other information
N/A