Skip to content

Numeric field value resets to min value if min > 0 and value is blank #2863

@chkpnt

Description

@chkpnt

Given a min value > 0 and a blank in the form field, the field will be reset to the min value if the field loses focus.

I encountered this issue in version 5.0.9, which is why I had to fork it internally. Now as I was preparing my fix to to submit to upstream, I saw someone else reported this issue as #2829 which you fixed in 7405873. 👍

Unfortunately, your approach to take "" into the condition solves the issue only partly: " " still triggers the behaviour. The root of the issue is using the <-operator with strings, therefore I recommend using parseFloat(...) before comparing the value with opt.min.

Here is a jsfiddle: https://jsfiddle.net/rcpxyg1t/6/

  • OS: macOS 15, iOS 18
  • Browser: Safari and Firefox on macOS, Safari on iOS
  • Inputmask version: 5.0.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions