Inconsistent handling of invalid input
tepi opened this issue · 2 comments
Description
Tested at https://vaadin.com/components/vaadin-date-picker/html-examples/date-picker-basic-demos#date-picker
When entering invalid input, the date picker does not handle it consistently.
Expected outcome
Either reset to previous valid value every time, or let the invalid input remain in the text box every time.
Actual outcome
Seemingly random behavior
Steps to reproduce
- Type "foo" into an empty date picker, press enter
- This selects today's date (why?)
- Select all text, clear it and type "foo" again, press enter
- Now the field stays invalid and "foo" remains in the text box
You can repeat clearing the field and entering "foo" and the date picker will alternate between these two behaviors.
Browsers Affected
All
Discussed with @jouni and agreed that this should be fixed to align "enter" key behaviour with "outside click" behaviour:
- Type "foo" into a date picker, press enter
- The value should be "",
datePicker.invalid
should betrue
and the field should still display "foo"
Here's an example with the desired behaviour: https://glitch.com/edit/#!/titanium-meteorite
Make sure a change
event gets dispatched when the value is set to ""
after invalid value is applied