ovh/ovh-ui-kit

[oui-numeric][oui-field] error message is not dynamic

jperchoc opened this issue · 1 comments

Description

When the min attribute of a oui-numeric is set to a dynamic value, the checks work well.
However, the error messages are not updating.

Steps to reproduce

Create two oui-numeric inputs. The value of the first one is used to set the min attribute of the second.

<oui-field data-label="input 1">
    <oui-numeric
        name="input1"
        data-model="$ctrl.input1Value"
        data-min="1"
        data-max="100"
        data-required
    ></oui-numeric>
</oui-field> 
<oui-field data-label="input 2">
    <oui-numeric
        name="input2"
        data-model="$ctrl.input2Value"
        data-min="$ctrl.input1Value"
        data-max="100"
        data-required
    ></oui-numeric>
</oui-field> 

Set input 1 value to 5

image
image

Click on the '+' button of the input 2, the value jumps from 0 to 5, and the '-' button is disabled.
image

Manually edit the input2 to 2.
The input is now invalid, but:

  • '-' button is now enabled
  • the text is incorrect (says "1" instead of "5")
    image

Expected behavior:

Text should show a correct min value.

Actual behavior:

Text shows an incorrect min value.

Frequency:
5 (always)

Additional information

I suspect the one-time binding in the field component template to be the cause of this bug: https://github.com/ovh/ovh-ui-kit/blob/master/packages/components/field/src/js/field.html#L26

This issue has been fixed with the PR #821
image