-
Notifications
You must be signed in to change notification settings - Fork 43
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
Any reason why there is no validator-cvapi? #43
Comments
Thank you so much for your interest! This really means a lot! First regarding the first part of your question: The reason I haven't focused that much on the Constraint Validation API is that it's generally not that good for a11y/mobile. In theory, even But anyway, a In that sense I have to ask, what do you mean by If it's the former, then using Felte loses a bit of its purpose since you're basically giving the browser all control back. If the latter, that's actually been on my mind but it would imply replicating what the browser does to validate each input. Regarding the second part:
Again, thanks a lot for giving Felte a try and I hope you enjoy using it! |
I totally understand your concerns and your reasoning behind the API as it is. My idea is simple to mitigate the shortcomings of the native validation-api with felte and use the good parts (like native i18n). This should be perfectly possible because of the nice design of felte! ;) Basically what I had in mind is the following: Given a simple form like (simplified for demo purposes):
I want the following behaviour:
Basically I want to use the validation the browser would do normally anyways. I don't want to use the builtin "bubbles" and I don't want the form to be in an invalid state direct after mounting - for the correct a11y-concerns. Those things should be farther handled by Benefits of the approach:
If I didn't miss anything important, it seems like a perfect match with very little overhead :) |
See #48 for a basic implementation. |
Let's actually keep this open until the PR gets merged. I quite like the approach of letting the issue close by itself when merging a related PR. Since this issue is actually still a thing until your solution gets merged 😊 |
Hey,
just played with felte and had to ask myself the question if there is any reason I don't see, why there is no
validator-cvapi
?Imho it could be lightweight validator for simple forms (like login f.e.) with built-in i18n. Most of the shortcomings of the cvapi are already handled by felte (premature validation, a11y-problems with the bubbles on mobile etc). So, am I overlooking something important or is it just not written yet? :)
Also while at it, I had a quick look on the api and noticed that the form itself isn't passed to the validate()-function - which would make the implementation of such an validator quite a bit harder. Therefor, additional question, any reasons for that? Maybe it could be a nice addition for extensibility to pass the form as a second arg I think!
And, last but not least: Thanks again for this great, well built, library! 💯
The text was updated successfully, but these errors were encountered: