-
Notifications
You must be signed in to change notification settings - Fork 5
Add search #194
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
Add search #194
Conversation
| if (firstResult) { | ||
| handleSelectOption(firstResult); | ||
| } | ||
| } |
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.
Missing preventDefault in Cmd+Enter handler causes double selection
Medium Severity
The Cmd+Enter keyboard handler calls handleSelectOption to select the first result, but unlike the Escape and Tab handlers which both call e.preventDefault(), this handler doesn't prevent the default event behavior. Since HeadlessUI's Combobox also handles Enter to select the currently focused option, both handlers may fire when Cmd+Enter is pressed. If the user has navigated to a different result using arrow keys, onSelectResult could be called twice with different results—first with the first result (from this handler), then with the focused result (from Combobox's internal handler).
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| setQuery(""); | ||
| setIsContentScrolled(false); | ||
| } | ||
| }, [isOpen]); |
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.
Stale results prevent recent searches from showing
Medium Severity
When the modal closes, query is internally reset to "" but onSearch("") is never called, leaving the parent's results array stale. The showRecentSearches condition requires results.length === 0, so recent searches are suppressed on reopen. This is especially problematic with SearchProvider, which omits onClose from searchProps, giving consumers no way to clear stale results on close.


Summary
add search modal
Test Plan
test with storybook
Note
Medium Risk
Adds a new interactive modal with global keyboard listeners and introduces a new UI dependency (
@headlessui/react), which may affect bundle size and shortcut/keyboard behavior across apps.Overview
Adds a new
Searchmodal component (Headless UIDialog+Combobox) with loading/empty states, recent searches, keyboard interactions (Esc close, Cmd/Ctrl+Enter select first), and optional top/center positioning.Introduces
SearchProvider/useSearchto manage open/close state and a configurableCmd/Ctrl+K-style global shortcut, plus aSearchButtonthat opens the modal and can display shortcut text; exports the newsearchmodule from the components index and adds Storybook stories demonstrating direct and provider-based usage.Updates
@mintlify/componentsdependencies (and lockfile) to include@headlessui/reactand its transitive packages.Written by Cursor Bugbot for commit 477250e. This will update automatically on new commits. Configure here.