Skip to content

Binding to store on select element doesn't work with on:input event. #7758

Open
@basuke

Description

@basuke

Describe the bug

In the event listener of input event of select which bind to store value, if the value of the same store but different property was changed, the bind itself doesn't work at all.

  1. Create a store with object: i.e. const s = writable({a:0, b: 0})
  2. Create a <select> element with bind:value={$s.a} and on:input={()=>$s.b++}.
  3. Change select element's value. It won't change the $s.a

Reproduction

https://svelte.dev/repl/6520010283474705a76372d5a2569e16?version=3.49.0

Logs

No response

System Info

System:
    OS: macOS 12.5
    CPU: (20) arm64 Apple M1 Ultra
    Memory: 46.50 GB / 128.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.9.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 103.0.5060.134
    Safari: 15.6

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions