Files
Danny White 30ab816ff4 feat(studio): make the Connect framework and client selectors searchable (#50072)
## What kind of change does this PR introduce?

Feature.

## What is the current behavior?

The Framework and Client selectors in the Connect sheet are plain
selects. Neither is scannable at its current length, and Client is the
worse of the two at 19 options.

## What is the new behavior?

Both are searchable comboboxes. Each keeps its selection, filters as you
type, matches on the underlying key as well as the label so `nextjs`
finds `Next.js`, and announces its empty state to screen readers.

| Before | After |
| --- | --- |
| <img width="1182" height="1250" alt="CleanShot 2026-09-07 at 14 47
12@2x"
src="https://github.com/user-attachments/assets/6243c549-03cc-41bf-8b3c-a186ca0e93b5"
/> | <img width="1178" height="1162" alt="CleanShot 2026-09-07 at 14 46
42@2x"
src="https://github.com/user-attachments/assets/d7ca5e72-3f8b-48e5-b20f-84382e4e4fd7"
/> |

Placeholder, search and empty-state copy now sit on the field definition
in the schema, next to the label, so one combobox component serves both
fields without guessing at plurals.

Client keeps its icons hidden, matching what the select did. The comment
about MCP images being unoptimized still stands, so this is not the PR
to turn them on.

Radix Select brings its own scroll lock, so replacing it with a popover
would have regressed touch scrolling in the sheet. #50103 moved that
guard into `CommandList` and has merged, so this branch now carries the
feature only.

## To test

- Open the Connect sheet on the deploy preview.
- Open the Framework selector, search for `native`, confirm only React
Native remains, select it, and confirm the generated connection
instructions update.
- Search `nextjs` and confirm Next.js matches on its key.
- Switch to the MCP tab and open Client. Search `cur` and confirm Cursor
matches.
- Confirm both lists cap their height and scroll, and that the sheet
behind stays put.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Framework selection now uses a searchable combobox for easier
navigation of long lists.
  * Search results clear automatically when the combobox closes.
  * Long framework lists appear in a contained, scrollable area.

* **Accessibility**
  * Screen readers announce when no frameworks match the search.
* Improved combobox and listbox relationships support assistive
technologies.
* The dropdown opens as a modal layer to keep focus within the selection
experience.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 00:35:05 +00:00

16 lines
682 B
TypeScript

/**
* cmdk filter for the Connect comboboxes, matching a plain substring against the option label and
* its key (passed through as a cmdk keyword) so `nextjs` finds `Next.js`.
*
* Also used to decide whether a combobox announces its empty state, so the announcement cannot
* disagree with what the list actually filtered out.
*/
export function getOptionMatchScore(value: string, search: string, keywords?: string[]) {
const normalizedSearch = search.trim().toLowerCase()
if (normalizedSearch.length === 0) return 1
const searchableValues = [value, ...(keywords ?? [])]
return searchableValues.some((item) => item.toLowerCase().includes(normalizedSearch)) ? 1 : 0
}