Skip to content

Bug: NumberField calls onChange with NaN when the field gets emptied #881

Open
@marcopiii

Description

@marcopiii

Description of the bug

When a NumberField gets emptied, the component calls the onChange function passing NaN as argument.

I would expect it to pass null or undefined: it would be way easier to handle such cases since it would be visible in the callback signature.

Playroom reproduction

https://playroom.bento.buildo.io/preview/#?code=N4Igxg9gJgpiBcJgB0B2ACdAKLBKdAvAHzooabqSoDOALugNoBuAhgDYCuMANOtTLQBq7LgF1C6AEowWYWgDoO-AMq0WtGFgAsAJlxoK6AE4CORjFgOH0AHgByHALYAjGEYBiASxhsoV6+ioLI4wBMggwRAcqLTh-tZsLK5sYSAAgo5RMXHkAQAOiWAwABYQvm6pACoAnnkw6MVuMPItOQGYrJyhwJ1cAL7xhhCoAMLFLKgA5t1MhCTAlMPUZc1sEJNYTLgA3HwCwl2b+H0DudYA1p6oUKlgZiaoYNVt7XdGD0+pAKIAqpIvhgA9ER4vpyH1cHg0KcQH0gA

Version

v0.22.22

What browsers are you seeing the problem on?

Chrome

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