Skip to content

Commit 8f0dd1d

Browse files
authored
refactor: simplify input element logic in DatePickerMixin (#9292)
1 parent a26ba6e commit 8f0dd1d

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

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

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,6 @@ export const DatePickerMixin = (subclass) =>
395395
this.__setEnteredDate(parsedDate);
396396
}
397397

398-
/** @private */
399-
get _nativeInput() {
400-
if (this.inputElement) {
401-
// TODO: support focusElement for backwards compatibility
402-
return this.inputElement.focusElement || this.inputElement;
403-
}
404-
return null;
405-
}
406-
407398
/**
408399
* The input element's value when it cannot be parsed as a date, and an empty string otherwise.
409400
*
@@ -903,7 +894,7 @@ export const DatePickerMixin = (subclass) =>
903894
this._focus();
904895
}
905896

906-
const input = this._nativeInput;
897+
const input = this.inputElement;
907898
if (this._noInput && input) {
908899
input.blur();
909900
this._overlayContent.focusDateElement();
@@ -969,8 +960,8 @@ export const DatePickerMixin = (subclass) =>
969960
}
970961
this.__commitParsedOrFocusedDate();
971962

972-
if (this._nativeInput && this._nativeInput.selectionStart) {
973-
this._nativeInput.selectionStart = this._nativeInput.selectionEnd;
963+
if (this.inputElement && this.inputElement.selectionStart) {
964+
this.inputElement.selectionStart = this.inputElement.selectionEnd;
974965
}
975966
// No need to revalidate the value after `_selectedDateChanged`
976967
// Needed in case the value was not changed: open and close dropdown,
@@ -1007,8 +998,8 @@ export const DatePickerMixin = (subclass) =>
1007998

1008999
/** @private */
10091000
_setSelectionRange(a, b) {
1010-
if (this._nativeInput && this._nativeInput.setSelectionRange) {
1011-
this._nativeInput.setSelectionRange(a, b);
1001+
if (this.inputElement) {
1002+
this.inputElement.setSelectionRange(a, b);
10121003
}
10131004
}
10141005

0 commit comments

Comments
 (0)