https://github.com/knowler/field-error-element
Exploring what a `<field-error>` element might look like.
https://github.com/knowler/field-error-element
Last synced: 4 months ago
JSON representation
Exploring what a `<field-error>` element might look like.
- Host: GitHub
- URL: https://github.com/knowler/field-error-element
- Owner: knowler
- Created: 2024-09-13T20:14:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-19T07:38:22.000Z (over 1 year ago)
- Last Synced: 2025-02-19T06:57:29.091Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ``
Exploring what a `` element might look like.
## [Exploration: set invalid on load](https://knowler.github.io/field-error-element/explorations/set-invalid-on-load/)
This strategy sets the form control as invalid with a custom error message on
load. The error message needs to be custom as that’s all we can set for built-in
elements, however, we could set non-custom constraint validation errors for
custom elements. I might explore that in the future.
Also, in the current implementation this will always report the validation when
focusing the element until it receives input at which time the custom error is
cleared (i.e. since that processing lives on the server). This likely is
annoying.
Some nice benefits here is that using the constraint validation API
automatically causes the element to receive the correct implicit ARIA values. Of
course, this doesn’t work without JS, but that’s besides the point of this
exploration.