-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Add Enter key support for Custom Select keyboard navigation #4830
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
Conversation
@copilot this is only about the following aspects, the others are fine: |
- Add Enter key handling in handleKeyboardPress function - For single select: Enter selects option and closes dropdown - For multiselect: Enter toggles selection (dropdown stays open) - Add comprehensive tests for both scenarios - Maintains existing Space key behavior Co-authored-by: mfranzke <[email protected]>
Could you clarify what action you'd like me to take regarding the Enter key functionality? Should I remove the Enter key implementation since you mentioned you'll integrate it yourselves, or keep it as is? I want to make sure I understand your request correctly. |
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.
Pull Request Overview
This PR enhances the Custom Select component's keyboard navigation by adding Enter key support to improve user experience based on usability testing feedback.
Key changes:
- Added Enter key functionality to select/deselect options in the keyboard event handler
- Implemented different behaviors for single select (closes dropdown) vs multiple select (keeps dropdown open)
- Added comprehensive test coverage for both single and multiple select scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
custom-select.lite.tsx | Added Enter key handling logic to trigger click events on focused checkbox/radio inputs |
custom-select.spec.tsx | Added test cases to verify Enter key functionality for both single and multiple select modes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
🦋 Changeset detectedLatest commit: 246b90d The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This PR enhances the Custom Select component's keyboard navigation by adding Enter key functionality to address user confusion reported in usability testing.
Problem
Users found the Custom Select keyboard navigation unintuitive:
Solution
Added Enter key support to the
handleKeyboardPress
function with behavior that matches user expectations:Single Select (Radio buttons)
Multiple Select (Checkboxes)
Escape key
Implementation Details
The solution detects when Enter is pressed on a focused checkbox or radio input and triggers a
click()
event to simulate the native Space key behavior. For single select scenarios, it additionally closes the dropdown and returns focus to the summary element. This is handled by the regular.click()
behaviour.Testing
Added comprehensive test coverage for both single and multiple select scenarios:
Manual testing confirms the implementation works as expected:
The screenshot shows successful testing of both scenarios - single select properly shows "Option 1" selected after Enter key usage.
Backward Compatibility
This change is fully backward compatible:
Fixes #4641.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
googlechromelabs.github.io
node install.js
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.