nuxt / nuxt/ui

InputNumber can return NaN

Open
#6,743 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
6.9k
Forks
1.1k
Avg merge
1d 7h
Merged PRs (30d)
57

Description

Environment

latest - see repro

Is this bug related to Nuxt or Vue?

Vue

Package

v4.x

Version

latest

Reproduction

https://play.ui.nuxt.com/#eNo9jzFvhDAMhf/KU5YDqYXreuKqdujQha1bFqCGQwpOBE5aCfHf6wP1puTZfp+fV/MeQpEimYuplm4eg2AhiQGu4eFqjSzWvFoep+BnwYqZemzoZz/hpLaTZcud50WQcL13s3NuuY/cyegZ3U0xlOVYLQP3Qe+ocH7IUpEaF+kJ41I39b/M1bxZrsoji25WITQF1wipAqqwP8AHC82wprAGI0NuhNb/oiXnfyAeAwkaKBs7efeWh7n6+uQQpY5Tq4j0PPlvcnpsUtTbEVnV8dHSZREKWjgXL9aUSqjKRySz/QH1Y2y8

Description

If the user enters "." or "-" into an InputNumber and hits enter, the resulting value is set to NaN.

NaN values cause all sorts of wacky problems - if the user does this, maybe just revert to the previous value instead?

Additional context

No response

Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction and the InputNumber component. Reproduce the result after entering "." or "-" and pressing Enter, then trace how that input is committed. Done means invalid input no longer sets the value to NaN and the previous value is preserved; add or update coverage if the component has tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.