Repository navigation
USWDS - Combo box search results - #6074
kodyjackson wants to merge 6 commits into
Conversation
mejiaj
left a comment
There was a problem hiding this comment.
@kodyjackson thanks for creating this. Left a question on time picker and can you double-check tests and prettier:check passes?
| @@ -1,7 +1,35 @@ | |||
| const assert = require("assert"); | |||
| const { generateDynamicRegExp } = require("../../../usa-combo-box/src/index"); | |||
There was a problem hiding this comment.
@kodyjackson the component still relies on combo box. Is there a particular reason why we removed this?
There was a problem hiding this comment.
The time-picker relied on an earlier version of generateDynamicRegExp, which matched strings by checking if any character from the list was present. The updated version, however, creates a regular expression that matches the starting characters of the list elements with the search query.
|
Considering findings and recommendations from the combo box landscape analysis 🔒 done earlier this year and conversations in CS UX sync from last April, it looks like we decided to try implementing a combo box solution similar to Elastic UI's where first letter navigation is prioritized, but that it also returns results with characters contained in the search terms. Kind of a "best of both worlds." |
|
Closing in favor of #6122. |

Summary
Implement First Letter Navigation for Combo Box Filtering
Breaking change
No breaking change
Related issue
Closes #5647
Problem statement
Users interacting with the combo box for selecting states or countries expect intuitive behavior where typing the first letter of an option narrows down the results to only those that begin with that letter. Currently, the combo box shows all results containing the typed letter, leading to confusion, as options like "Connecticut" appear when users type "T." This does not align with user expectations and can hinder the overall usability of the component.
Solution
The solution implements first letter navigation in the combo box's filtering logic. By modifying the generateDynamicRegExp function, we ensure that only the options starting with the typed letter are displayed, providing a more accurate and user-friendly experience.
Major changes
Modification of
generateDynamicRegExpFunction:Testing Enhancements: