Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 22, 2025

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:

  • Enter key had no function, while users expected it to select/deselect options
  • Space key worked for selection but users didn't think to use it
  • This led to confusion and users thinking the component was broken

Solution

Added Enter key support to the handleKeyboardPress function with behavior that matches user expectations:

Single Select (Radio buttons)

  • Enter key: Selects the focused option and closes the dropdown
  • Space key: Unchanged - continues to work for consistency

Multiple Select (Checkboxes)

  • Enter key: Toggles selection of the focused option, keeps dropdown open
  • Space key: Unchanged - continues to work for consistency

Escape key

  • Unchanged - still closes the dropdown

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:

  • Single select: Verifies Enter selects option and closes dropdown
  • Multiple select: Verifies Enter toggles selection while keeping dropdown open
  • Existing Space key functionality remains unchanged

Manual testing confirms the implementation works as expected:

Enter Key Functionality Test

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:

  • All existing Space key behavior is preserved
  • Escape key functionality unchanged
  • No breaking changes to the API
  • New Enter key functionality is purely additive

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
    • Triggering command: 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.

@mfranzke
Copy link
Collaborator

@copilot this is only about the following aspects, the others are fine:
"Auswahl mit Entertaste ← wird von uns integriert"

- 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]>
@Copilot Copilot AI changed the title [WIP] Custom Select - Tastaturbedienung nicht intuitiv feat: Add Enter key support for Custom Select keyboard navigation Aug 22, 2025
Copilot finished work on behalf of mfranzke August 22, 2025 20:13
@Copilot Copilot AI requested a review from mfranzke August 22, 2025 20:13
Copy link
Contributor Author

Copilot AI commented Aug 22, 2025

@copilot this is only about the following aspects, the others are fine:
"Auswahl mit Entertaste ← wird von uns integriert"

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.

Copilot finished work on behalf of mfranzke August 22, 2025 20:16
@mfranzke mfranzke marked this pull request as ready for review August 25, 2025 15:46
@mfranzke mfranzke moved this to 👀 In review in UX Engineering Team Backlog Aug 25, 2025
@mfranzke mfranzke added this to the 3.1.0 milestone Aug 25, 2025
@mfranzke mfranzke added this to Roadmap Aug 25, 2025
@mfranzke mfranzke requested a review from Copilot August 25, 2025 15:54
Copy link
Contributor

@Copilot Copilot AI left a 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.

@mfranzke mfranzke enabled auto-merge (squash) August 25, 2025 16:10
Copy link

changeset-bot bot commented Aug 25, 2025

🦋 Changeset detected

Latest 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

@github-actions github-actions bot added the 📕documentation Improvements or additions to documentation label Aug 26, 2025
@michaelmkraus michaelmkraus disabled auto-merge August 28, 2025 11:39
@mfranzke mfranzke moved this from 👀 In review to ready for release in UX Engineering Team Backlog Aug 28, 2025
@mfranzke mfranzke enabled auto-merge (squash) August 31, 2025 18:30
@mfranzke mfranzke merged commit dc5e3d0 into main Aug 31, 2025
53 of 54 checks passed
@mfranzke mfranzke deleted the copilot/fix-4641 branch August 31, 2025 18:46
@github-project-automation github-project-automation bot moved this from ready for release to ✅ Done in UX Engineering Team Backlog Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👩‍👧‍👦communityFeedback Feedback from community 🏘components ⏏️custom-select 📕documentation Improvements or additions to documentation
Projects
Status: No status
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Custom Select - Tastaturbedienung nicht intuitiv
3 participants