fix(searchbar): caret moving to the end when typing

This commit is contained in:
davdiv
2017-05-27 15:03:16 +02:00
committed by Manu MA
parent f14d7d6524
commit 261bc4d5f4

View File

@ -188,7 +188,9 @@ export class Searchbar extends BaseInput<string> {
*/ */
_inputUpdated() { _inputUpdated() {
const ele = this._searchbarInput.nativeElement; const ele = this._searchbarInput.nativeElement;
if (ele) { // It is important not to re-assign the value if it is the same, because,
// otherwise, the caret is moved to the end of the input
if (ele && ele.value !== this.value) {
ele.value = this.value; ele.value = this.value;
} }
this.positionElements(); this.positionElements();