Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
steffanek opened this issue Oct 30, 2024 · 0 comments
Labels
STATUS-1: needs triage This doesn't seem right TYPE: bug Something isn't working

Comments

@steffanek
Copy link
Contributor

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

@steffanek steffanek added TYPE: bug Something isn't working STATUS-1: needs triage This doesn't seem right labels Oct 30, 2024
@steffanek steffanek changed the title [🐞] When initial value chosen is the first one from the options array, the placeholder is then displayed [🐞] When the initially selected value is the first item in the options array, the placeholder is displayed instead. Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage This doesn't seem right TYPE: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant