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

RadioItem with empty value not selectable #332

Closed
rudiv opened this issue Feb 14, 2024 · 1 comment · Fixed by #362
Closed

RadioItem with empty value not selectable #332

rudiv opened this issue Feb 14, 2024 · 1 comment · Fixed by #362
Assignees
Labels
bug Something isn't working

Comments

@rudiv
Copy link

rudiv commented Feb 14, 2024

Describe the bug

It appears to be impossible to select an empty value within a DropdownMenu's RadioGroup.

I'm assuming this is related to this piece of code, specifically testing if (next ..., as an undefined or null or '' would fail this test and result in the value change not running.

Whilst maybe not a bug, it is annoying when using the radio group for an optional filter, where it's expected that "no filter" would be a state of "undefined".

Reproduction

let whatever: any = undefined;
// .. 
<DropdownMenu.RadioGroup bind:value={whatever}>
    <DropdownMenu.RadioItem value={undefined}>All</DropdownMenu.RadioItem>
    <DropdownMenu.RadioItem value="1234">1234</DropdownMenu.RadioItem>
</DropdownMenu.RadioGroup>

Logs

No response

System Info

System:
    OS: macOS 14.2.1
    CPU: (20) arm64 Apple M1 Ultra
    Memory: 93.30 GB / 128.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm
  Browsers:
    Safari: 17.2.1
  npmPackages:
    @sveltejs/kit: ^2.5.0 => 2.5.0 
    bits-ui: ^0.18.1 => 0.18.1 
    svelte: ^4.2.10 => 4.2.10

Severity

annoyance

@rudiv rudiv changed the title RadioItem with empty value not working RadioItem with empty value not selectable Feb 14, 2024
@huntabyte huntabyte added the bug Something isn't working label Mar 1, 2024
@huntabyte huntabyte self-assigned this Mar 1, 2024
@huntabyte
Copy link
Owner

You are now able to use an empty string here! My apologies for the oversight on the conditional!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants