processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

InputfieldFloat with input type number does not apply "any" as step attribute

Open Toutouwai opened this issue 2 months ago • 2 comments

The string "any" is a valid value for the step attribute of input type number: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/number#step

But InputfieldFloat does not apply this value if given (it applies .01):

Image

PW 3.0.252

Toutouwai avatar Oct 26 '25 07:10 Toutouwai

Looking at the code, it's by design - it doesn't allow "any". For your usecase, does it help if you set step to 1?

matjazpotocnik avatar Oct 26 '25 14:10 matjazpotocnik

I managed to get step="any" by setting precision to -1, but it's not intuitive that this would be necessary. It would help if the docs indicated what's required to achieve "any" if InputfieldFloat is not going to apply it when it's specifically set for the property.

It also seems wrong for the documentation to say that the default for "step" is "any" when that's not what you get if you create an instance of InputfieldFloat with minimal settings:

Image

Toutouwai avatar Oct 26 '25 21:10 Toutouwai