PolymerElements / paper-input

A Material Design text field
https://www.webcomponents.org/element/PolymerElements/paper-input
130 stars 159 forks source link

Setting paper-input.value messes with minlength validation #576

Open stivaliserna opened 7 years ago

stivaliserna commented 7 years ago

Description

Using polymer 2, if I have a paper-input with some validation:

              <paper-input value="{{x}}"
                            auto-validate
                            id="pass"
                            minlength="12"
                            required
                            type="password">
              </paper-input>

Works ok if users go and type into the input. Whoever, if I programatically change the input value, the validation is lost:

const input = element.shadowRoot.querySelector('#pass')

input.value = 'too-short'
input.validate() // => true

Expected outcome

input.validate() should be false, because value is shorter than minlength.

Actual outcome

input.validate() is true.

Steps to reproduce

  1. Define a paper-input with some minlength attribute
  2. Programatically set input's value to something shorter
  3. Call .validate()

Browsers Affected