Skip to content

Options of <select multiple={true}> have incorrect selected property value #17280

@Bladesheng

Description

@Bladesheng

Describe the bug

When you set the multiple attribute on <select> element dynamically (e.g. with some variable, or a function), the children <option> elements will always have selected property value equal to false, even when they have selected attribute.

Reproduction

https://svelte.dev/playground/97cac4d339644901b93d6e289d054bd4?version=5.45.2

As you can see, the first 2 <select> have correctly preselected the first 2 options, but the other selects have only 1 option selected.
The selected attributes are set correctly, but the properties are not.

Image Image

System Info

Chrome 142.0.7444.175
Svelte 5.45.2

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