I'm submitting a ... (check one with "x")
[x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Plunkr Case (Bug Reports)
http://plnkr.co/edit/ZGrHJtP5gt8hgVG8lqNO?p=preview
Current behavior
When trying to type a decimal into the spinner, if a step less than 0 is set (i.e. 0.1), typing in a number with a decimal will erase the decimal if it isn't type quickly enough, for example typing 1.5 slowly results in 15, but placing a decimal between 1 and five will leave 1.5.
With a step of 1, using the example above, typing 1.5 results in 15, and placing the decimal between 1 and 5 results in 1, meaning the decimal and any trailing numbers are erased altogether.
Expected behavior
Decimals should not be removed.
Minimal reproduction of the problem with instructions
angular 4+ w/ primeng 4.3.0+.
What is the motivation / use case for changing the behavior?
A user should be able to type in a decimal regardless of the step set, or their typing speed.
*note
This is happening in parseValue through the onInputKeyup event. Inside that function parseFloat or parseInt are called based on 'precision' being set. parseFloat removes the trailing decimal if no number follows, and parse int removes the decimal and any trailing numbers.
the fact is that no decimals can be entered whether we use a . or a ,
if you go to your homepage spinner https://www.primefaces.org/primeng/#/spinner
and take the second example (that has a step of 0.5) and try to enter whatever decimal it doesn't work. So entering decimals should be allowed . I leave it open if this should be related to a step number or not
Same problem here, using Primeng version 4.3.0+.
I can't type a decimal in a spinner.
It seems to be a major problem, could'n't it be corrected in 4.X ?
Same problem here, using Primeng version 5.0.2
you need to mention step directive like [step]
@andreipreda i cant typ in the demo on https://www.primefaces.org/primeng/#/spinner in the field Step "0.25", which version you use?
4.1.2
@cagataycivici The fix put in place does not account for zeros. For example, if a user (somewhat slowly) types 1.05, parsing takes place on 1.0, and the resulting number is 15.
As @BearInHat already mentioned, the issue is not resolved yet and should be re-opened. Please consider my pull request #5737 that addresses the problem of typing zeros.
Reverting as it broke spinner.
This isn't fixed for .01 case, unless you type it freakishly fast or maybe cut/paste you can't type 1.01 in the spinner. It changes it to '11'.
Tracked at #5490
Most helpful comment
@cagataycivici The fix put in place does not account for zeros. For example, if a user (somewhat slowly) types 1.05, parsing takes place on 1.0, and the resulting number is 15.