Skip to content

Commit 6e04c8d

Browse files
authored
fix: focus entered date on open with auto-open disabled (#4828)
1 parent 711ba0a commit 6e04c8d

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎packages/date-picker/src/vaadin-date-picker-mixin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ export const DatePickerMixin = (subclass) =>
10971097

10981098
/** @private */
10991099
_userInputValueChanged() {
1100-
if (this.opened && this._inputValue) {
1100+
if (this._inputValue) {
11011101
const parsedDate = this._getParsedDate();
11021102

11031103
if (this._isValidDate(parsedDate)) {

‎packages/date-picker/test/keyboard-input.test.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,15 @@ describe('keyboard', () => {
598598
expect(datepicker.opened).not.to.be.true;
599599
});
600600

601+
it('should focus parsed date when opening overlay', async () => {
602+
await sendKeys({ type: '1/20/2000' });
603+
await open(datepicker);
604+
await waitForOverlayRender();
605+
606+
expect(focusedDate().getMonth()).to.equal(0);
607+
expect(focusedDate().getDate()).to.equal(20);
608+
});
609+
601610
it('should set datepicker value on blur', async () => {
602611
await sendKeys({ type: '1/1/2000' });
603612
await sendKeys({ press: 'Tab' });

0 commit comments

Comments
 (0)