Skip to content

Commit

Permalink
fix: focus entered date on open with auto-open disabled (CP: 14) (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
sissbruecker authored Oct 25, 2022
1 parent 651c6cc commit 54ce200
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-date-picker-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@

/** @private */
_userInputValueChanged(value) {
if (this.opened && this._inputValue) {
if (this._inputValue) {
const parsedDate = this._getParsedDate();

if (this._isValidDate(parsedDate)) {
Expand Down
8 changes: 8 additions & 0 deletions test/keyboard-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,14 @@
expect(datepicker.opened).not.to.be.true;
});

it('should focus parsed date when opening overlay', () => {
inputText('1/20/2000');
datepicker.open();

expect(focusedDate().getMonth()).to.equal(0);
expect(focusedDate().getDate()).to.equal(20);
});

it('should set datepicker value on blur', () => {
inputText('1/1/2000');
datepicker.dispatchEvent(new Event('blur'));
Expand Down

0 comments on commit 54ce200

Please sign in to comment.