Fixed Unusual behaviour of xf:numberbox

abdfahim

Well-known member
Affected version
2.1
I have the following numberbox in a template.

Code:
<xf:numberbox name="fieldname" value="" maxlength="10" min="0" max="20" step="5" required="{{ false }}" />

This has two distinct behaviour which I think is either bug or unintuitive

1) Initially, when the box is empty (value = ""), irrespective of whether I click + or - button, it starts from the maximum value (20). I think intuitively, it should show the minimum value (0) instead.

2) When the number reaches it's minimum (value = 0), if I click - button, I receive the following error in the console
195748

This issue doesn't appear when I click + button at maximum (value = 20).
 
First, I can't reproduce the stepDown error on any browser (Chrome, FF, Edge or IE11). It may have been a temporary browser bug, or perhaps there's more to your form that leads to that.

In terms of the behavior with an empty value, this is generally an internal browser behavior as we use the built in stepUp/stepDown methods. Only IE and Edge seem to behave the way you're reporting (with the max). Both FF and Chrome start at 0. I don't think we'd be making any changes here.
 
First, I can't reproduce the stepDown error on any browser (Chrome, FF, Edge or IE11).

In terms of the behavior with an empty value, this is generally an internal browser behavior as we use the built in stepUp/stepDown methods. Only IE and Edge seem to behave the way you're reporting (with the max). Both FF and Chrome start at 0. I don't think we'd be making any changes here.
I can observe both the issues in Safari 12.0.3 on MacOS Mojave 10.14.3.

I can also confirm that these issues do not appear in Chrome 72.0.3626.121 on the same OS (MacOS Mojave 10.14.3).

I don't use EDGE/IE, so can't tell about those.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.1).

Change log:
Prevent an InvalidStateError in some cases with the numberbox input. Also change its support detection and prevent the stepping starting from an unexpected number.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom