-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Motivation
The client libraries card currently uses a native HTML <select> dropdown to allow users to choose from additional programming language clients beyond the featured ones. Native select elements have limited styling capabilities and provide an inconsistent user experience across different browsers and operating systems. They also don't integrate well with modern design systems.
By replacing the native select with a custom combobox component from the Scalar component library, we can provide a more polished, consistent user experience that matches the rest of the application's design system. This also gives us better control over accessibility, keyboard navigation, and visual presentation while maintaining the same functionality.
Current Behavior
The client libraries selector displays featured language clients as individual tabs, with a native HTML <select> dropdown for accessing all other available clients. The select element uses <optgroup> tags to group clients by their target language/platform.
Reproduction Steps:
- Navigate to any API reference page that displays client libraries
- Observe the client selector UI showing featured clients (like Shell, JavaScript, Python) as tabs
- Look for the dropdown selector (typically labeled "More") that contains additional client options
- Click on the dropdown and observe it uses a native browser select element
- Notice the select options are grouped by language/platform using optgroups
- Select a non-featured client from the dropdown
- Observe: The native select has limited styling and doesn't match the application's design system
Expected Behavior
The client libraries selector should use the ScalarCombobox component instead of a native HTML select element, providing a consistent, styled experience that integrates with the Scalar design system.
Acceptance Criteria:
- The native
<select>element is replaced withScalarComboboxcomponent from@scalar/components - All available client options remain accessible through the combobox with proper grouping by language/platform
- Selecting a client from the combobox updates the active client state correctly
- The currently selected client is properly reflected in the combobox display
- The combobox maintains the same functionality as the previous select element (users can switch between all available clients)
Verification
Manual Testing:
- Run the development server and navigate to an API reference page with client libraries
- Verify the client selector displays featured clients as tabs and a combobox for additional options
- Click on the combobox and verify it opens with all available clients grouped by language/platform
- Select different clients from the combobox and verify the code snippet updates accordingly
- Verify the combobox displays the currently selected client's name
- Test keyboard navigation within the combobox
- Verify the UI is consistent with the rest of the Scalar design system
Automated Testing:
- Run existing test suite:
pnpm test - Verify all existing tests pass and component behavior is unchanged
- Check that the component properly handles client selection state
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx