Skip to content

[TextField] Validate function works incorrect with attribute "validateOnFocusOut" #3940

Description

@IASamoylov

Bug Report

  • Package version(s): (5.49.0)
  • Browser and OS versions: (All)

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? (Yes)

Requested priority: (Normal)

Describe the issue:

epwNV_)

Steps:

  1. Set incorrect text in the first field
  2. Change focus
  3. To observe an error
  4. Set focus in the first field
  5. Remove one symbol
  6. Return removed symbol
  7. Change focus

Actual behavior:

If we re-enter incorrect value the way showed in video, the focus out validation will not be triggered

TextField (line: 422)

if (this._latestValidateValue === value) {
      return;
}

Expected behavior:

If we re-enter incorrect value the way showed in video, the focus out validation will be triggered

TextField (line: 422)

If value doesn't modify and validated by changed value, then return;

const { validateOnFocusIn, validateOnFocusOut } = this.props;
if (this._latestValidateValue === value && !(validateOnFocusIn || validateOnFocusOut)) {
      return;
}

If applicable, please provide a codepen repro:

Example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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