-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
v-model breaks HTML's minlength attribute validation #1935
Comments
when value updated, accoring to https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#setting-minimum-input-length-requirements:-the-minlength-attribute , the value validated by validation is the one last changed by a user edit (as opposed to a change made by a script) so it's better to use @yyx990803 I can fix this usage scenario (value is only modified by its bound |
@unbyte The PR you provided will probably fix that, however, just like you see, the problem still persists when ditching Not quite sure what the correct solution should be. I can probably use |
@Zohenn I found the way to fix it😀. working. |
@Zohenn i believe i have fixed it completely. However, to make |
@unbyte Maybe someone else will look into this and provide a different solution. I'm afraid I can't help you with this, but you're probably right about it being not the most optimal fix. |
what about using |
@unbyte I'm currently using Still, if someone finds HTML5 validation enough for his needs, they may encounter this problem again at some point, since The best solution would be to forget about |
fix #1935 (fix v-model usage with HTML5 validation)
Version
3.0.0-rc.7
Reproduction link
https://jsfiddle.net/07ye1wu6/
Steps to reproduce
What is expected?
Both inputs have red backgrounds, since browser should render them as invalid.
What is actually happening?
The input with
v-model
directive is treated as if it was valid,minlength
validation is completely ignored.The problem seems to occur only when using
minlength
,pattern
with minimum characters regex works fine.I couldn't reproduce the issue with Vue 2, so I guess the bug is somewhere in v3, if it is a bug to begin with.
The text was updated successfully, but these errors were encountered: