Skip to content

[EuiFieldNumber] Safari marks as invalid floating point numbers when step is not provided #5327

@dej611

Description

@dej611

I've noticed this issue while testing few components in Lens, which can be quite misleading for the user I think.

This is an example of a UI affected by this:

Screenshot 2021-10-27 at 15 58 11

the first time I saw it I thought the values were invalid somehow, but after the investigation I found it was the Safari correct about the spec. 😓

While by default the fallback value for step is the integer value 1, hence any floating point should be invalid, most browser do not respect this and let the user input any value. Safari is the only browser which implements the invalid check by the spec on this side.

(source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#step )

Safari:
Screenshot 2021-10-27 at 15 49 50

Chrome:
Screenshot 2021-10-27 at 15 54 01

Using the any step value seems to align Safari with the rest of the browsers for the validation.

I'd propose to add a any fallback for the step prop on the EuiFieldNumber component to fix this behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions