feat(search): allow free-text values when editing a filter pill#2471
feat(search): allow free-text values when editing a filter pill#2471zoov-xavier wants to merge 3 commits into
Conversation
|
@zoov-xavier is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 3ae47eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The active filter pill's value picker was a closed Select limited to the field's existing values, so a filter could only be switched to a value already present in the sampled data. Replace it with an Autocomplete that accepts arbitrary typed input (committed on Enter or blur) while keeping the existing suggestions. Keyboard navigation of the dropdown is preserved: when an option is highlighted, Enter submits that option natively; free text is only committed when no option is highlighted. A commit guard avoids applying the same value twice (onOptionSubmit followed by onBlur).
3afe05b to
828dc53
Compare
- Scope the highlighted-option lookup to this input's own listbox (via
aria-controls) instead of the whole document, so another open combobox
on the page can't make us swallow Enter and drop free-text entry.
- Pin the keyboard-navigation test to the expected option ('404') instead
of accepting any value from the list.
Deep ReviewMulti-agent review of the free-text filter-pill value picker ( 🔴 P0/P1 — must fix
🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, agent-native, learnings-researcher. Testing gaps:
|
pulpdrew
left a comment
There was a problem hiding this comment.
Just one question about a potential simplification, but I like the functionality!
| commitValue(draftValue); | ||
| } | ||
| }} | ||
| onBlur={() => commitValue(draftValue)} |
There was a problem hiding this comment.
Is this prop necessary here? I would generally not expect what I type to submit whenever clicking out of the popover, and it seems (while testing) like in that case commitValue is being called with an empty draftValue anyway.
And if we got rid of this, could we also get rid of the commitRef?
Please let me know if there is a reason this is needed that I'm overlooking!
Summary
The active filter pill's value picker (added in #2455) is a closed
Selectlimited to the field's existing values. That means a filter can only ever be switched to a value already present in the sampled data. This PR replaces it with a MantineAutocompleteso you can type any value while still seeing the existing suggestions.[data-combobox-selected]), Enter submits that option natively viaonOptionSubmit; free text is only committed when no option is highlighted.onOptionSubmit, thenonBluras the menu closes).Why
Editing a pill only let you switch to a value that already exists in the data. When you want to filter on a value that hasn't appeared yet (a new service name, a release tag about to ship, an error code not seen in the sample window), you had no way to enter it from the pill — you had to type it as a raw query instead. Free-text entry closes that gap while keeping the suggestion-driven flow for the common case.
Test plan
yarn ci:unit ActiveFilterPills.test.tsx— 28 tests, incl. new coverage for free-typed values not in the list and for keyboard-navigated option selection via Entertsc --noEmiton@hyperdx/app— cleanyarn linton@hyperdx/app— 0 errorsA changeset (
@hyperdx/app: patch) is included.