Skip to content

<select> displays wrong choice when options are dynamically updated #17148

@lachrymaLF

Description

@lachrymaLF

Describe the bug

If a <select> is bound to a state not equal to the initial value and its options are updated, the element will snap to display the initial value that does not match the state variable. This issue was introduced in 5.41.0, it does not occur in 5.40.2.

Reproduction

svelte.dev

  1. Add option
  2. Select option that is not the initial value
  3. Add another option
  4. <select> now displays the wrong option

With an $effect snapping to a different (still wrong) value
svelte.dev

  1. Add 2 options
  2. Select option that is not 0
  3. Add another option
  4. <select> now displays the wrong option

Logs

System Info

Chromium 140.0.7339.185
Firefox 145.0
Safari 26.1 (21622.2.11.11.9)

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions