Skip to content

[🐞] When the initially selected value is the first item in the options array, the placeholder is displayed instead. #1001

Closed
@steffanek

Description

@steffanek

Which package is affected?

Headless Kit

Describe the bug

Let's take the example from the docs > headless > select > uncontrolled

export default component$(() => {
  useStyles$(styles);
  const users = ['Tim', 'Ryan', 'Jim', 'Jessie', 'Abby'];

  return (
    <Select.Root value="Jessie" class="select">
      <Select.Label>Logged in users</Select.Label>
      <Select.Trigger class="select-trigger">
        <Select.DisplayValue placeholder="Select an option" />
      </Select.Trigger>
      <Select.Popover class="select-popover">
        {users.map((user) => (
          <Select.Item key={user}>
            <Select.ItemLabel>{user}</Select.ItemLabel>
          </Select.Item>
        ))}
      </Select.Popover>
    </Select.Root>
  );
});

If I change the initial value to "Tim" meaning the first from the users, it will display the placeholder "Select an option".
This only occur when the first item from the users array is used.

Reproduction

@qwik-ui: apps > website > src > routes > docs > headless > select > uncontrolled

Steps to reproduce

No response

System Info

System:
    OS: macOS 14.3
    CPU: (8) arm64 Apple M3
    Memory: 959.19 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.2.0 - /opt/homebrew/bin/node
    npm: 10.7.0 - /opt/homebrew/bin/npm
    pnpm: 9.7.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Safari: 17.3
  npmPackages:
    @builder.io/qwik: ^1.8.0 => 1.8.0
    @builder.io/qwik-city: ^1.8.0 => 1.8.0
    @qwik-ui/headless: ^0.6.2 => 0.6.2
    @qwik-ui/styled: ^0.2.0 => 0.2.0
    @qwik-ui/utils: ^0.3.1 => 0.3.1
    typescript: 5.4.5 => 5.4.5
    undici: * => 6.19.7
    vite: 5.3.5 => 5.3.5

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions