Skip to content

Native validation doesn't dismiss errors as the user corrects them #6983

@sbking

Description

@sbking

Provide a general summary of the issue here

React ARIA's "native" validation doesn't work like HTML5 native validation works in most browsers, which results in a significantly worse user experience.

🤔 Expected Behavior?

In most modern browsers, when an HTML5 validation error is already showing, the validation error will update in real time until the user has fixed it, and then the error will immediately go away without the user blurring the field.

😯 Current Behavior

When validationBehavior is set to "native" and a validation error is showing, the error will never go away until the user blurs the field. The error message also won't update if the native validation issue changes until the user blurs the field.

💁 Possible Solution

I think the useFormValidation component should have two modes:

  • A "lazy" mode which is initially active - in this mode it would only call state.commitValidation() in the change event handler
  • An "eager" mode which becomes active while a native validation error is showing - in this mode if would call state.commitValidation() in an input event handler

🔦 Context

No response

🖥️ Steps to Reproduce

https://codesandbox.io/s/quirky-meitner-jl79fh?file=/src/App.js

Version

latest

What browsers are you seeing the problem on?

Firefox, Chrome, Safari

If other, please specify.

No response

What operating system are you using?

macOS Sonoma 14.3

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions