Skip to content

Commit

Permalink
fix(ui5-date-picker): keyboard handling now compliant with the specif…
Browse files Browse the repository at this point in the history
…ication

- Focus is moved on the component input field after closing
the corresponding popover via Escape keyboard key.

Fixes SAP#3091
  • Loading branch information
unazko committed Aug 11, 2021
1 parent 2a22fff commit e4ce4ec
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
4 changes: 1 addition & 3 deletions packages/main/src/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,8 @@ class DatePicker extends DateComponentBase {
this._isPickerOpen = false;
if (isPhone()) {
this.blur(); // close device's keyboard and prevent further typing
} else if (this._focusInputAfterClose) {
} else {
this._getInput().focus();
this._focusInputAfterClose = false;
}
}

Expand Down Expand Up @@ -710,7 +709,6 @@ class DatePicker extends DateComponentBase {
const newValue = event.detail.values && event.detail.values[0];
this._updateValueAndFireEvents(newValue, true, ["change", "value-changed"]);

this._focusInputAfterClose = true;
this.closePicker();
}

Expand Down
1 change: 0 additions & 1 deletion packages/main/src/DateRangePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ class DateRangePicker extends DatePicker {

const newValue = this._buildValue(...event.detail.dates); // the value will be normalized so we don't need to order them here
this._updateValueAndFireEvents(newValue, true, ["change", "value-changed"]);
this._focusInputAfterClose = true;
this.closePicker();
}

Expand Down
1 change: 0 additions & 1 deletion packages/main/src/DateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ class DateTimePicker extends DatePicker {
this.fireEvent("value-changed", { value: this.value, valid });
}

this._focusInputAfterClose = true;
this._updateValueState();
this.closePicker();
}
Expand Down

0 comments on commit e4ce4ec

Please sign in to comment.