-
Notifications
You must be signed in to change notification settings - Fork 0
Enable typing to open and search select dropdowns #164
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?
Conversation
- Add keydown handler to select trigger that opens popover when typing printable characters - Automatically focus search input when popover opens - Set initial search query to the typed character - Clear search query when popover closes - Maintains normal keyboard navigation (Enter, Space, Arrow keys, etc.)
|
|
WalkthroughThe Select component now features enhanced keyboard interaction and search input management. Changes include adding a search input ref, focusing the search field when the popover opens, opening the popover via keyboard input with instant search query population, clearing the search query on close, and ensuring the selected item remains in view. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Trigger
participant Component
participant SearchInput
participant Popover
User->>Trigger: Type printable character
Trigger->>Component: onKeyDown event
Component->>Component: handleTriggerKeyDown
Note over Component: Pre-fill searchQuery with character
Component->>Popover: Open popover
Popover->>Component: onOpenChange triggered
Component->>SearchInput: Focus via searchInputRef
Component->>Component: Scroll selected item into view
User->>Popover: Close/Blur
Popover->>Component: onOpenChange triggered
Component->>Component: Clear searchQuery
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (14)packages/components/src/ui/**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
packages/components/src/ui/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
packages/components/src/{remix-hook-form,ui}/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/form-component-patterns.mdc)
Files:
{apps,packages}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
{apps,packages}/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
packages/components/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
{apps,packages}/**/src/**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
packages/components/src/ui/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/monorepo-organization.mdc)
Files:
packages/components/src/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.tsx📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,mdx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/**/src/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Comment |
|
📝 Storybook Preview: View Storybook This preview will be updated automatically when you push new changes to this PR.
|
Overview
This PR adds the ability to open select dropdowns and start searching immediately when typing while focused on the select trigger. This improves the user experience by making select components feel more responsive and keyboard-friendly.
Changes
Testing
The changes were tested and the component builds successfully:
yarn lintpassesyarn workspace @lambdacurry/forms buildsucceedsExample Usage
Now when you focus the select and start typing "Cal", the dropdown will open and show California in the filtered results.
Implementation Details
searchInputRefto track the search input elementhandleTriggerKeyDownto detect printable characters and trigger the open/search behavioruseEffectto auto-focus the search input when openingRequested by: Jake Ruesink (@jake)
💻 View my work • About Codegen
⛔ Remove Codegen from PR • 🚫 Ban action checks
Summary by CodeRabbit