Skip to content

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

Closed

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

Activity

  1. falco467 commented on Feb 9, 2026

    @falco467

    This is a severe regression bug introduced with version 5.41 which is producing a lot of irritation and problems without a clear workaround to mitigate. It is currently a blocking problem for us as well.

  2. falco467 commented on Feb 9, 2026

    @falco467

    I think the problem was probably introduced by this commit:
    #16958
    from @Rich-Harris

    If the Options-List is updated while the select is the active Element the update is skipped. But if the option list changes the update is neccessary, even if the select has focus, since it needs to update to display the value correctly.

  3. added theissue type on Mar 4, 2026
  4. added a commit that references this issue on Mar 13, 2026
    3dbd950
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions