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

minlength and maxlength are not validated when value is set programmatically #4358

Open
vursen opened this issue Aug 16, 2022 · 0 comments
Open

Comments

@vursen
Copy link
Contributor

vursen commented Aug 16, 2022

Description

Both minlength and maxlength don’t validate programmatically set values as follows from the HTML specification. This means that checkValidity() of text-field and text-area may give a false positive result if any of the mentioned constraints are set and the value is set programmatically.

A finding from #4196

Expected outcome

I would expect minlength and maxlength to be validated correctly regardless of the origin of the value: programmatic or user.

Minimal reproducible example

<script type="module">
  import '@vaadin/text-field';

  const textField = document.querySelector('vaadin-text-field');
  textField.value = 'Test Value';
  textField.validate();
</script>

<vaadin-text-field minlength="50"></vaadin-text-field>

Steps to reproduce

  1. Add the snippet above to an HTML page
  2. See that the field is not red = valid even though the value doesn't satisfy minlength.

Environment

Version: 23.2
OS: Mac OS

Browsers

Issue is not browser related

@vursen vursen added the bug Something isn't working label Aug 16, 2022
@vursen vursen changed the title minlength and maxlength are not validated for values set programmatically minlength and maxlength are not validated when value is set programmatically Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants