-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
<select value> does not select correct option on first render when using one-way binding #1252
Comments
That's because |
I'm aware they do different things, I just mentioned that In pure HTML I'd have
Is this the official way to approach this problem without resorting to two-way binding? Or should |
This is working for me, with the 'selected' attr on the final option. I tried to link the REPL I was using but it won't save. When I change the bottom right JSON back and forth:
The drop-down is changing for me. |
@okane103 Even tough you get the right solution shouldn't it be solving it via |
This works in v3, so I'll close this: https://svelte.dev/repl?version=3.0.0-beta.28&gist=985e5864be8a9887350b2ab4ca2a220f |
will this work with Server Side Rendering (SSR) ? |
When specifying a
value
for a<select>
, the element does not select correct option upon rendering for the first time. It always select the first available<option>
, regardless of that option's value. After the first render, if I change the state, then the correct option gets selected.Steps to reproduce:
Expected behavior:
Observed behavior:
state.value
is "bar".If I change
<select :value>
to<select bind:value>
, the correct option gets selected.REPL:
User Agents:
The text was updated successfully, but these errors were encountered: