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

next: Select breaks when using transition on content #753

Closed
jjones315 opened this issue Oct 10, 2024 · 3 comments
Closed

next: Select breaks when using transition on content #753

jjones315 opened this issue Oct 10, 2024 · 3 comments

Comments

@jjones315
Copy link

Describe the bug

When using a transition on the select content, the select is no longer part of the form after a selection is made.

Reproduction. (you made need to npm install --force)
The page has 3 selects,
The first has no transition, select a value and hit submit, the form values will display and log to the console.
The second has a transition with the {#snippet child({...})} Pattern, select a value and it will be removed from the form values.
The third has a global transition, select a value and it will be removed from the form values.

Reproduction

https://stackblitz.com/edit/github-shpwk7-zlxesb?file=src%2Froutes%2F%2Bpage.svelte

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.6.3 
    bits-ui: ^1.0.0-next.15 => 1.0.0-next.15 
    svelte: ^5.0.0-next.262 => 5.0.0-next.262

Severity

blocking an upgrade

@huntabyte huntabyte added the next label Oct 14, 2024
@huntabyte
Copy link
Owner

Hmm, I actually don't think this one is fully fixable with the Select using the child snippet and a conditional. You'll miss functionality like the typeahead portal link and such. I'm considering dropping the Select in favor of just having the Listbox; I just need to figure out how to handle the typeahead stuff for that.

It requires a child/children to register the values for each<Select.Items> when they mount. I could probably hack it together but until that open conditional is true, anything within the content isn't mounted and therefore doesn't register.

@jjones315
Copy link
Author

jjones315 commented Oct 15, 2024

That would work for most cases, I have a few where items are visually grouped, so it’s nice to be able to provide a top level content child, could the components just accept a items/options prop with an array of label/value to be used?

@huntabyte
Copy link
Owner

Yep! That's exactly what I'm implementing now 😃

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

No branches or pull requests

2 participants