Skip to content

Hide CardPicker type selector when type search is disabled#5234

Draft
FadhlanR wants to merge 2 commits into
mainfrom
cs-11322
Draft

Hide CardPicker type selector when type search is disabled#5234
FadhlanR wants to merge 2 commits into
mainfrom
cs-11322

Conversation

@FadhlanR

Copy link
Copy Markdown
Contributor

Background and Goal

CS-11322 — when the card chooser's baseFilter already constrains card type (e.g. a linksTo field), the Type picker in the search bar is redundant: the type is pinned and the user can't change it. This PR hides the picker entirely in that situation, and polishes the underlying boxel-ui Picker so disabled state is reflected in the trigger, the search input, and selected-item remove buttons via the component API (no opacity hacks).

Where to start

  • packages/host/app/components/card-search/search-bar.gts<TypePicker> wrapped in {{#unless @typeFilter.skipTypeFiltering}}. That's the user-visible behavior change.
  • packages/boxel-ui/addon/src/components/picker/index.gts + before-options-with-search.gts — new @searchEnabled arg (default true) and a showSearch getter that hides the search input section when the picker is disabled or @searchEnabled is false.
  • packages/boxel-ui/addon/src/components/picker/trigger-labeled.gtsis-disabled modifier on the trigger (not-allowed cursor + muted colour) when disabled.
  • packages/boxel-ui/addon/src/components/picker/selected-item.gts — replaced the :hover { opacity: 0.7 } hack on the remove button with a --boxel-200 background hover.

Key decisions and non-obvious mechanics

  • "This situation" maps to typeFilter.skipTypeFiltering, which is true iff getTypeSummaries.hasNonRootBaseFilter — i.e. the baseFilter pins a non-root type. AI assistant card-catalog (CardDef root baseFilter) → still shows the picker. Pet linksTo (non-root) → hides it.
  • The picker's existing displayRemoveButton already returned false when the picker was disabled. The remove-button test in this PR pins that behavior; the visible changes are the trigger and search-input states the ticket called out.
  • Search-icon placement (the fourth UI bullet on the ticket) is already addressed by Fix realm picker search icon overlapping placeholder text #5230; not duplicated here.

When the card chooser's baseFilter already constrains the card type
(e.g. a linksTo field), the Type picker is redundant — the type is
pinned and the user can't change it. Wrap <TypePicker> in
{{#unless @typeFilter.skipTypeFiltering}} so it doesn't render in
that situation.

Picker (boxel-ui) polish driven by the ticket's component-level notes:
- Accept @searchEnabled (default true); hide the search input section
  when the picker is disabled or @searchEnabled is false.
- Trigger gets an is-disabled visual state (not-allowed cursor + muted
  colour) when the picker is disabled.
- Replace the opacity:0.7 hover hack on selected-item remove buttons
  with a --boxel-200 background hover.

Closes CS-11322
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files  ± 0      1 suites  ±0   1h 38m 1s ⏱️ +57s
3 065 tests +13  3 050 ✅ +13  15 💤 ±0  0 ❌ ±0 
3 084 runs  +13  3 069 ✅ +13  15 💤 ±0  0 ❌ ±0 

Results for commit 1337cf7. ± Comparison against earlier commit 0d00675c.

Realm Server Test Results

    1 files  ±0      1 suites  ±0   11m 11s ⏱️ +48s
1 716 tests +1  1 716 ✅ +1  0 💤 ±0  0 ❌ ±0 
1 809 runs  +1  1 809 ✅ +1  0 💤 ±0  0 ❌ ±0 

Results for commit 1337cf7. ± Comparison against earlier commit 0d00675c.

The keydown handler that owns ArrowUp/Down, Enter, Escape, and Tab
navigation was bound to the search input. When @searchEnabled is false
the input does not render, so without an input there was no listener
and the dropdown could not be navigated by keyboard.

Move the handler to the .picker-before-options wrapper (tabindex=-1)
so keydown events bubble from either the search input or, when search
is hidden, a small focus-target div that the autoFocus modifier
focuses on open. The existing keyboard-nav tests keep passing because
events still bubble from the input; a new test exercises ArrowDown
with @searchEnabled={{false}}.

Drop the now-redundant select.disabled branch in showSearch — EPS
never mounts before-options when the picker is disabled.

Drop the .picker-selected-item__remove:hover override so the
ContextButton highlight variant's own hover takes effect, matching
the design system rather than overriding it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant