Skip to content

Render native Option rows in Select and PowerSelect - #762

Open
JulienVannier66 wants to merge 4 commits into
jv/vel-8817/oss-components-infiniteselect-option-and-contextmenu-foundationsfrom
jv/vel-8818/oss-components-native-option-rows-in-select-and-powerselect
Open

JulienVannier66 wants to merge 4 commits into
jv/vel-8817/oss-components-infiniteselect-option-and-contextmenu-foundationsfrom
jv/vel-8818/oss-components-native-option-rows-in-select-and-powerselect

Conversation

@JulienVannier66

@JulienVannier66 JulienVannier66 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Second step of aligning the Search dropdowns with the dropdown design system. OSS::Select and OSS::PowerSelect can now render OSS::InfiniteSelect::Option rows directly, so consumers no longer build their own rows (checkbox, check icon, wiring).

Stacked on #761: it targets its branch and should be merged after it.

  • Select and PowerSelect get a new :row named block. It yields the item, an Option component already wired, and the index: <:row as |item Option index|>. The consumer only passes display arguments (@title, @prefixCountry, @subtitle…).
    • Select wires it with selectionType="single", selected and onSelect going through the Select (onChange, then close).
    • PowerSelect wires it with selectionType="multiple" and selected = "the item is in @selectedItems". A consumer can still pass its own @selected. The dropdown stays open after a selection.
  • Select no longer requires a block: without one, each item is rendered as an Option row titled with @targetLabel.
  • Select accepts @valueKey to compare the current value with the items by key. Without it, the comparison stays by reference. It also applies to the check icon of the legacy :option rows.
  • PowerSelect accepts @disabled: the dropdown cannot be opened and the field uses the existing disabled style.
  • InfiniteSelect: Enter no longer selects a row whose Option is disabled.

The legacy :option and :option-item blocks render as before, so the existing usages are untouched and can be migrated later.

How the rows are rendered

For each item, Select picks the first block it finds:

  1. :row (new): Select yields the item, an Option component already wired, and the index. The consumer only passes display arguments, and its arguments win over the wired ones (e.g. @selected, @disabled). The wired ones are selectionType="single", selected (current value) and onSelect (onChange, then close).

    <OSS::Select @items={{this.countries}} @value={{this.country}} @valueKey="id" @onChange={{this.setCountry}}>
      <:row as |item Option|>
        <Option @title={{item.name}} @prefixCountry={{item.id}} />
      </:row>
    </OSS::Select>

    The component is curried by name, (component "o-s-s/infinite-select/option" …), because Embroider rejects (component this.x) as an unsafe dynamic component.

  2. :option (legacy): unchanged item-wrapper + check icon. Only the check now goes through isSelected, so @valueKey works here too.

  3. No block: Select renders <OSS::InfiniteSelect::Option @title={{concat (get item targetLabel)}} />. concat turns a non-string label (number, missing key) into text, since Option requires a string title.

    <OSS::Select @items={{this.fieldOptions}} @value={{this.field}} @valueKey="key" @onChange={{this.setField}} />

isSelected: no current value → no row checked; without @valueKey → by reference, as before; with @valueKey → by key, and no row is checked when the current value has no such key.

PowerSelect uses the same :row block with selectionType="multiple" (checkbox, no check icon). A row is selected when its item is in @selectedItems (the consumer can pass @selected instead), and the dropdown stays open after a selection. There is no default rendering: :option-item or :row is required.

<OSS::PowerSelect @items={{this.languages}} @selectedItems={{this.selectedLanguages}} @onChange={{this.toggleLanguage}} @onSearch={{this.search}}>
  <:selected-item as |language|>{{language.name}}</:selected-item>
  <:row as |item Option|>
    <Option @title={{item.name}} />
  </:row>
</OSS::PowerSelect>

Related to: https://linear.app/upfluence/issue/VEL-8818/oss-components-native-option-rows-in-select-and-powerselect

What are the observable changes?

In Storybook:

  • OSS::Select → With Row Named Block, Without Option Block and With Value Key (the current value is a copy of the item and is still checked).
  • OSS::PowerSelect → With Row Named Block (checkbox rows, no extra check icon, selected rows in primary-50 / primary-500) and Disabled.
  • The existing stories using :option / :option-item look as before.

No visible change in the apps until the consumers move to :row (Search selects in VEL-8819).

Good PR checklist

  • Title makes sense
  • Is against the correct branch
  • Only addresses one issue
  • Properly assigned
  • Added/updated tests
  • Added/updated documentation with Figma design link. Don't forget to replace "design" by "file" in the URL. For example https://www.figma.com/file/example
  • Migrated touched components to Glimmer Components
  • Properly labeled

@JulienVannier66 JulienVannier66 self-assigned this Dec 3, 2026
@linear-code

linear-code Bot commented Dec 3, 2026

Copy link
Copy Markdown

VEL-8818


@action
toggleDropdown(event: MouseEvent): void {
if (this.args.disabled) return;

@phndiaye phndiaye Dec 3, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some PowerSelects, we have rules like:

  • if more than 3 items, only display one chip saying " items selected" (for example ("4 countries selected")
Screenshot 2026-12-03 at 16 11 57

in that case, we kinda rely on the dropdown to see what's currently selected.

If coupled with that new rule, it means users are blocked with only the <n> items selected without knowing what 😅

This branch has not been deployed

No deployments
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.

2 participants