Skip to content

Conversation

@lindsayzhng
Copy link
Contributor

@lindsayzhng lindsayzhng commented Feb 6, 2026

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 Search modal component (Headless UI Dialog + Combobox) with loading/empty states, recent searches, keyboard interactions (Esc close, Cmd/Ctrl+Enter select first), and optional top/center positioning.

Introduces SearchProvider/useSearch to manage open/close state and a configurable Cmd/Ctrl+K-style global shortcut, plus a SearchButton that opens the modal and can display shortcut text; exports the new search module from the components index and adds Storybook stories demonstrating direct and provider-based usage.

Updates @mintlify/components dependencies (and lockfile) to include @headlessui/react and its transitive packages.

Written by Cursor Bugbot for commit 477250e. This will update automatically on new commits. Configure here.

@lindsayzhng lindsayzhng marked this pull request as ready for review February 6, 2026 01:28
if (firstResult) {
handleSelectOption(firstResult);
}
}
Copy link

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).

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a 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]);
Copy link

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.

Additional Locations (2)

Fix in Cursor Fix in Web

@lindsayzhng lindsayzhng merged commit a09b4c6 into main Feb 8, 2026
3 checks passed
@lindsayzhng lindsayzhng deleted the lindsay/eng-6130-add-search branch February 8, 2026 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants