The documentation says that you can use the iron-input-validate event to validate an input. This is not actually possible because the .validate() method returns a value before firing the event, so the event is not able to change the outcome of validation.
Expected outcome
Custom validation using event should be able to set the invalid property.
Actual outcome
The invalid property is overridden because .validate() returns a value before firing an event, and _handleValueAndAutoValidate sets this.invalid based on that return value. Ideally, it should not override this.invalid if it has already been set to false.
Description
The documentation says that you can use the
iron-input-validate
event to validate an input. This is not actually possible because the.validate()
method returns a value before firing the event, so the event is not able to change the outcome of validation.Expected outcome
Custom validation using event should be able to set the
invalid
property.Actual outcome
The
invalid
property is overridden because.validate()
returns a value before firing an event, and_handleValueAndAutoValidate
setsthis.invalid
based on that return value. Ideally, it should not overridethis.invalid
if it has already been set tofalse
.Live Demo
https://jsbin.com/joxoyizamo/edit?html,output
Browsers Affected