Skip to content

For input[type=number] bound value not equal event value #584

@saibotsivad

Description

@saibotsivad

Reproduction of issue in this REPL: https://svelte.technology/repl?version=1.20.2&gist=348577339ab2e03462b1279b38d9975b

This issue occurs when using a bound value and the on:change event for an <input type="number"> element.

  • What I did: enter a value in the input element, kill focus by clicking away, clear contents of input element, kill focus by clicking away.
  • What happens: the first value shows up as the bound value and the event value as expected, but after clearing the input element and killing focus, the bound value is 0 while the event value is "".
  • What I expect to happen: when an input element is cleared, the emitted on:change event value should allow for the empty string, and not coerce the value to 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions