web-components
web-components copied to clipboard
[date-picker] Manually set invalid state is automatically removed on blur
Description
If manually setting datePicker.invalid = true
the field becomes invalid and red, but then if the field is focused and then unfocused it automatically becomes valid again and not red anymore. This doesn't seem right. E.g. vaadin-text-field
and vaadin-time-picker
both keep it as invalid even if the user focuse and unfocuses/blurs the field.
Expected outcome
When <vaadin-date-picker>
has been explicitly set as invalid, it should not become valid just by focusing and unfocusing it.
Actual outcome
When <vaadin-date-picker>
has been explicitly set as invalid, it becomes valid just by focusing and unfocusing it.
Steps to reproduce
https://cdn.vaadin.com/vaadin-date-picker/4.0.6/demo/#date-picker-basic-demos
- Inspect the first
vaadin-date-picker
on the page and make it invalid by executing$0.invalid = true
(notice the text field will become red). - Click on the text field of the date picker to focus it (or focus it via keyboard)
- Unfocus the date picker either by clicking outside of it or navigating out of it via keyboard (notice the field is not red anymorebut it should be).
Other
Might be related to vaadin/vaadin-date-picker#696.
I checked that this is still a valid issue also with date picker 4.0.7.
It's an intended behaviour in the latest version.