Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce API to reveal violated constraints when validation fails #7893

Open
vursen opened this issue Oct 1, 2024 · 1 comment
Open

Introduce API to reveal violated constraints when validation fails #7893

vursen opened this issue Oct 1, 2024 · 1 comment
Labels
enhancement New feature or request validation

Comments

@vursen
Copy link
Contributor

vursen commented Oct 1, 2024

Describe your motivation

Components are missing an API to reveal which specific constraints have been violated when component validation fails. As a result, developers have to reproduce the entire validation logic in their listeners to be able to identify which error message should be displayed:

image

The validity state is partially available through the input element's validity object. However, information about some constraints is still unavailable because they are implemented as a custom feature, e.g. pattern in text-area.

Describe the solution you'd like

Components should implement an API similar to ValidityState that would indicate which specific constraints have failed to make implementing error messages cleaner.

@vursen
Copy link
Contributor Author

vursen commented Oct 1, 2024

Related ticket: #1177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request validation
Projects
None yet
Development

No branches or pull requests

2 participants