Skip to content

Commit

Permalink
fix: focus entered date on open with auto-open disabled (#4828)
Browse files Browse the repository at this point in the history
  • Loading branch information
sissbruecker authored Oct 25, 2022
1 parent 711ba0a commit 6e04c8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/date-picker/src/vaadin-date-picker-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ export const DatePickerMixin = (subclass) =>

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

if (this._isValidDate(parsedDate)) {
Expand Down
9 changes: 9 additions & 0 deletions packages/date-picker/test/keyboard-input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ describe('keyboard', () => {
expect(datepicker.opened).not.to.be.true;
});

it('should focus parsed date when opening overlay', async () => {
await sendKeys({ type: '1/20/2000' });
await open(datepicker);
await waitForOverlayRender();

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

it('should set datepicker value on blur', async () => {
await sendKeys({ type: '1/1/2000' });
await sendKeys({ press: 'Tab' });
Expand Down

0 comments on commit 6e04c8d

Please sign in to comment.