Skip to content

Behaviour is not exactly like the native input[type='number'] #56

@V-ed

Description

@V-ed

For a quick test, simply set data-step="2", set the value to 5, and try to decrement : expected 3, got 2. You can also do this test in your live demo in your "Dynamically handling of min, max, step and data-decimals" section (sidenote : would be nice if there was ids to your page sections, so we could link them directly in links!).

Same goes with increment, incrementing an odd number by an even number does not give the expected result (with the last example, I would expect 5 + 2 = 7, but 8 is currently being produced).

I realized that by doing some tests on my own fork, and tracing back I found that you changed to a rounding logic in this commit : be6b7c8, and now I'm wondering what is that "better form handling".

A fix for this would be to change this line :

setValue(Math.round(value / step) * step + step)

to :

setValue(value + step)

... but I figure there was an issue to doing simply that, as this is what you had previously... so here's an issue to discuss about it :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions