Repository navigation
feat(site/src): let filter categories hide while they offer one option - #29875
Conversation
Design review fixes for the unified workspace search and filter: - Show a dotted filter icon on the toggle while any chip is applied. - Render chips as a muted `key:` prefix with a prominent value. - Present Attributes chips as `attribute:<key>` and rename the category key to `attribute` (with `attributes` as an alias) so chips, the draft prefix, and typed prefixes all use the same pattern. - Dropdown rows: 34px tall, 8px horizontal padding, 24px icon slot with 18px lucide icons and 24px avatars, 13px regular text, group headers with 16px above (8px list padding only for the first header). - Use `BuildingIcon` for Organization and `TagIcon` for Attributes. - Result rows inherit the row colour so text and icons highlight together; drop the workspace result subtitle. - Size the chip-row input to its content so an empty input never forces a second row, and match its height to a chip so the box does not change height when the first chip is added. - Prefix the pagination summary with "Filtered:" while a query is set and use "No workspaces match your search." for empty filtered results, with a "Clear all" button in the empty state.
Owner, Status, Attributes, Template, Organization.
Keep Building2Icon for Organization to match the rest of the app, and render the dotted active filter icon at 20px so it reads the same size as the plain 18px icon.
…er/coder into fix/filter-combobox-feedback
Each category row in the filter dropdown now ends with either the labels of its applied chips plus a check mark, or a short sample of its options (templates and organizations are pulled from the deployment). Categories can provide a hint shown while options load.
Clicking the filter toggle, or pressing Backspace on an empty input, while a category is open returns to the category list instead of closing the menu.
…ate and drop mobile scroll timers Inline categories such as Status and Workspace attributes no longer enter category mode when their prefix is typed; the prefix narrows the inline group in place, so no duplicate flyout renders. The pointer flyout now follows the cmdk highlight, closing or switching when keyboard navigation moves on. The browsing and category main panels share one renderer. On mobile the open field pins below the navbar with CSS instead of timer-driven scrolling.
… highlighted after leaving it Returning from a category with ArrowLeft or by picking an option left cmdk pointing at an unmounted option row, so nothing in the menu looked focused. The highlighted row is now controlled state owned by the hook and is set back to the parent category on return. This also replaces the highlight reset counter with the controlled value and drops memoization around cheap derived lists.
…eedback # Conflicts: # site/src/pages/WorkspacesPage/filter/WorkspacesFilter.stories.tsx # site/src/pages/WorkspacesPage/filter/WorkspacesFilter.tsx
…mouse-interactions # Conflicts: # site/src/components/Filter/FilterCombobox/primitives.tsx # site/src/pages/WorkspacesPage/WorkspacesPage.stories.tsx # site/src/pages/WorkspacesPage/WorkspacesPage.tsx # site/src/pages/WorkspacesPage/filter/WorkspacesFilter.stories.tsx # site/src/pages/WorkspacesPage/filter/WorkspacesFilter.tsx
Replaces the separate User category with a switch in the Owner list footer. While on, picking a user commits user:<name>, which also matches workspaces shared with them, and the chip reads owner: <name> +shared. Flipping the switch rewrites an applied Owner chip in place. The Shared attribute option is removed in favor of the toggle. Clicking the already focused input reopens a dismissed menu, and a dismissed flyout no longer reappears on reopen.
The toggle is on by default. While on, the search field shows a removable include shared pill instead of a chip suffix, and removing it narrows the applied Owner chip. Applied chips always render in lowercase regardless of the option label shown in the menu.
… input does to the listed rows
|
/coder-agents-review |
There was a problem hiding this comment.
Round 19 of the opt-in hideWhenSingleOption change. Findings: none new.
CRF-116 is fixed in e1d5666: the two cases are titled by what each typed input does to the listed rows. The merge of base commit a46a961 changes no production line this PR adds or removes. In test setup, the resolution keeps this PR's shouldAdvanceTime option in place of the base's fakeTimers: "manual", and the base's new test makes the same vi.useFakeTimers({ shouldAdvanceTime: false }) call as before. The base's shownOptions now reads the options this PR loads at render for hideable categories, so typing template: for a hidden Template lists its one option from cache. No findings from this review remain open.
Out of scope (needs a ticket or explicit acceptance by a human):
site/src/components/Filter/FilterCombobox/useFilterCombobox.ts:790:activeOptionsSearchedtrimsactiveOptionsQuerySource, which the base branch now trims where it is defined (:538); both lines are base code.
🤖 This review was automatically generated with Coder Agents.
…ch failure only for the settled text A failed search no longer blocks or skews Enter after the text is edited. shownOptions takes the failure and only current results, so the flyout, category view, and typeahead share one rule, and the hook returns the category view's empty text.
…r-combobox-hide-single-option # Conflicts: # site/src/components/Filter/FilterCombobox/useFilterCombobox.ts
|
/coder-agents-review |
There was a problem hiding this comment.
Round 20 of the opt-in hideWhenSingleOption change. Findings: 2 P4.
The only change since the round 19 approval is the merge of base commit 772c11c. Its resolution is correct: the base's new typeahead loop runs over optionLookupCategories, the same list the typeahead queries use, so hidden categories still get no suggestions. Both findings concern lines that exist because of merge resolutions: a filter that duplicates an existing guard and hides a test gap, and a test setup signature that makes every merge rewrite the base's manual-clock tests.
Out of scope (needs a ticket or explicit acceptance by a human):
site/src/components/Filter/FilterCombobox/useFilterCombobox.ts:645: the base branch's comment ontypeaheadOptionsByKeyrestates thecontinuebelow it.
🤖 This review was automatically generated with Coder Agents.
…ions and keep the base setup signature
|
/coder-agents-review |
… hide rows for a failed load Also covers both empty texts with stories, moves the category loading check to a manual-clock test, and shares the manual-clock flyout opening.
…r-combobox-hide-single-option
There was a problem hiding this comment.
Round 21 of the opt-in hideWhenSingleOption change. Findings: none new.
5ad6d51 fixes both findings from round 20. The typeahead loop is back to the base's for (const { key } of categories), so the menuCategories argument to collectValueSuggestions is the only line that keeps a hidden category's options out of suggestions, and the new {ArrowDown}{Enter} step in "ignores hidden options for suggestions ..." fails when that argument is changed to categories. Test setup matches the base again, and setupDeferredTemplateLoads maps its own shouldAdvanceTime to true or "manual", so both of its callers keep the clock they had. No findings from this review remain open.
🤖 This review was automatically generated with Coder Agents.
…ries reach their text and group timer helpers
…r-combobox-hide-single-option # Conflicts: # site/src/components/Filter/FilterCombobox/FilterCombobox.test.tsx
|
/coder-agents-review |
There was a problem hiding this comment.
Round 22 of the opt-in hideWhenSingleOption change. Findings: none new.
Since the round 21 approval, the head moved only by merges of base commits 1e9641c and bd10913. This PR's added and removed lines are the same as before the merges. The test-file conflict is resolved by placing the base's openOwnerFlyoutOnManualClock before this PR's added tests, where the base has it. 1e9641c moves the failed-load check into shownOptions; a hidden category has no typeahead query, so its rows are never marked failed there, and collectValueSuggestions still skips them because it reads menuCategories. A failed hideable category stays listed through failedOrRetryingKeys, which the merges do not change, so its flyout still shows the error and Retry. No findings from this review remain open.
🤖 This review was automatically generated with Coder Agents.
…box-remove-workspace-previews # Conflicts: # site/src/components/Filter/FilterCombobox/FilterCombobox.tsx # site/src/components/Filter/FilterCombobox/types.ts # site/src/pages/WorkspacesPage/filter/WorkspacesFilter.tsx
…workspace-previews' into fix/filter-combobox-mouse-interactions # Conflicts: # site/src/components/Filter/FilterCombobox/FilterCombobox.tsx # site/src/components/Filter/FilterCombobox/primitives.tsx # site/src/components/Filter/FilterCombobox/useFilterCombobox.ts
…r-combobox-hide-single-option
…ouse-interactions # Conflicts: # site/src/components/Filter/FilterCombobox/FilterCombobox.stories.tsx # site/src/components/Filter/FilterCombobox/FilterCombobox.tsx # site/src/components/Filter/FilterCombobox/queries.ts # site/src/components/Filter/FilterCombobox/types.ts # site/src/components/Filter/FilterCombobox/useFilterCombobox.ts
…ptions as buttons
…nline options (#29426) ## Summary Improves mouse and touch interactions for the workspace FilterCombobox while preserving its keyboard navigation. The filter control (icon only) now opens a compact main menu with inline status and workspace-state options, pointer flyouts for Owner, User, Template, and Organizations, and a single-panel mobile flow. Applied chips always render lowercase. Selected workspace attributes remain single-select to match the existing workspace filtering UI. Stacked on #29874 (removes the workspace result previews). Follows #29111, which has merged. Split out and stacked on this PR: #29875 (hide single-option categories), #29876 (Clear all), and #29872 (Owner shared workspaces toggle). <details> <summary>Implementation notes</summary> - Keeps Up/Down, ArrowRight, ArrowLeft, Backspace, Escape, and Tab keyboard behavior. Free-typed text no longer highlights the first row: Enter applies it as a search and closes the menu, while arrow keys, Home/End, cmdk's Ctrl+N/J/P/K, or the pointer pick a filter row. Tab still completes the top row, and a typed `key:` prefix, the category view, and the all-filters list keep the first match highlighted. - Enter activates any focused button in the combobox (Filters, flyout options, Retry, chip remove) through one `FilterComboboxRoot` handler. - The menu's height is bounded only by the viewport, so it scrolls only when it cannot fit. - Uses right-opening pointer flyouts with hover forgiveness and searchable, scrollable long lists. The flyout follows the cmdk highlight, so keyboard navigation closes or switches it, and it resets whenever the menu opens or closes. - Inline categories (Status, Workspace attributes) never enter category mode; a typed `status:` prefix narrows the inline group in place and is withheld from the workspace search query. A failed inline load shows its error and Retry under the category heading, since inline categories have no flyout. - Browsing and category mode share one main-panel renderer. - Uses a persistent full-width mobile panel with touch scrolling. While open on mobile the field pins below the navbar with CSS (`fixed`), with no JS scroll positioning. Verified in Chrome device emulation, not yet on a physical device with a software keyboard. - Keeps free-text workspace searches separate from matching filter-option text, including text typed before a `status:` prefix. Typed text that could still match a filter (a category name, a loaded option, or an option the category's search returns) is held back from the workspace search, so results do not empty out mid-word. It is applied when no lookup finds a match (a failed lookup counts as no match, and the wait stops after 1s), on Enter, or when the menu is dismissed or switched to all filters. The menu shows no separate cue for held-back text; the author (@tracyjohnsonux) decided this, and also rejected a `Search workspaces for "..."` row. That is why Enter-search is built by suppressing cmdk's automatic first-row highlight (`userNavigatingRef` and the `""`/`" "` reset in `FilterComboboxRoot`) rather than by rendering a search row. Chip tokens in the typed text become chips when it is applied. - While typed text is debounced, loaded options are filtered locally so matching rows stay visible until the loader's results arrive. - Enter or Tab on an applied option that typed text located keeps it and clears the text. Clicking a checked row removes it. - Enter commits a typed inline value that is not a suggestion, such as `status:starting`. - Flyout searches go through the category loader, so owners beyond the first page are found. The search field stays mounted while results load, shrink, or are empty. - Clicking a category row narrowed by typed text enters the category, and focus returns to the input after picking a flyout option. - Keeps selected options visible with Coder-standard checkmarks and styling. - `FilterCategory.chipLabelOnly` marks categories whose chips show only the option label (Workspace attributes). Inline options load up front so those chips are labelled before the menu is first opened. - Pointer flyouts and category lists share one `OptionsPanel` shell (search header, list, empty state). </details> Generated by Coder Agents. --------- Co-authored-by: Jake Howell <jacob@coder.com> Co-authored-by: Jake Howell <jake@hwll.me>
…hide-single-option # Conflicts: # site/src/components/Filter/FilterCombobox/FilterCombobox.stories.tsx # site/src/components/Filter/FilterCombobox/FilterCombobox.test.tsx # site/src/components/Filter/FilterCombobox/FilterCombobox.tsx # site/src/components/Filter/FilterCombobox/primitives.tsx # site/src/components/Filter/FilterCombobox/types.ts # site/src/components/Filter/FilterCombobox/useFilterCombobox.ts
Summary
Leaves a filter category out of the menu while it offers at most one choice, since filtering by it would not narrow the results. For example, a deployment with a single template or organization no longer shows the Template or Organization rows. An applied chip keeps its category listed so it can still be changed, a failed lookup keeps it listed so it can offer Retry, and typed filters such as
template:dockerkeep working.Hiding is opt-in with
FilterCategory.hideWhenSingleOption, which Workspaces sets on Template and Organization. WhengetOptions("")omits values the results can contain (deprecated templates, organizations withoutaudit_log:read), the row can hide while its one option would still narrow the results; this tradeoff is accepted by the author, since a deployment with one template or organization already shows everything. Inline categories (Status, Workspace is…) are unaffected.Hideable categories load their options when the filter renders. If the menu opens first, it shows one skeleton placeholder row per submenu category until they load; the list that replaces them can be shorter. Typed text still matches a category whose options are loading, and a failed load keeps the category in the menu while its Retry runs; a Retry that returns at most one option removes the row, like any other single-option category. On Workspaces the Template list reuses the templates query the page already runs, so the only new page-load requests are for Organizations:
GET /api/v2/organizationsand onePOST /api/v2/authcheck.A hidden category's options are not offered as typeahead suggestions and do not hold typed text back from the workspace search. Its name and
key:prefix still work.Stacked on #29426, split out so it can be reviewed on its own.
Generated with Coder Agents on behalf of @tracyjohnsonux.