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

Proper binding work for the "select" element when "option" list changed #1730

Closed
stalkerg opened this issue Sep 12, 2018 · 1 comment
Closed

Comments

@stalkerg
Copy link
Contributor

Currently, Svelte didn't update value binding if you change options list in select. It's happening because browser didn't fire any event for that case but change value and ui.
A small example here: https://svelte.technology/repl?version=2.13.4&gist=2f292a1414939dfc3f69fccb37b72f73

Also some description of how it works for Angular users:
https://medium.com/@kastepanyan24/how-to-set-selected-option-dynamically-in-angular-6-85c99958cca5

Unfortunately, we should emit an event manually every time when we change the options list.
But I think it's a bad idea because of default behavior very odd, the browser just shifted value instead try to keep current.
If we want to keep current value after DOM modification we should do something like keyd "each" construction.

@antony
Copy link
Member

antony commented Dec 24, 2019

Closing this in favour of #1764 which has more conversation around the issue.

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