From 0513bc558c4d4d6f9cdcc293cbf041c4cfa3e1aa Mon Sep 17 00:00:00 2001 From: RistiCore Date: Mon, 29 Oct 2018 11:28:43 +0300 Subject: [PATCH] fix(timepicker): Noisy cursor movements on arrow keys (#61) --- src/lib/timepicker/timepicker.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/timepicker/timepicker.ts b/src/lib/timepicker/timepicker.ts index 09218eca0..358e841a7 100644 --- a/src/lib/timepicker/timepicker.ts +++ b/src/lib/timepicker/timepicker.ts @@ -433,10 +433,14 @@ export class McTimepicker extends McTimepickerMixinBase this._currentDTimeInput = timeToApply; if (doTimestringReformat && timeToApply !== undefined) { + const selectionStart: number = this._elementRef.nativeElement.selectionStart; + const selectionEnd: number = this._elementRef.nativeElement.selectionEnd; this._renderer.setProperty( this._elementRef.nativeElement, 'value', this._getTimeStringFromDate(timeToApply, this.timeFormat)); + this._elementRef.nativeElement.selectionStart = selectionStart; + this._elementRef.nativeElement.selectionEnd = selectionEnd; } ( this.ngControl.control).updateValueAndValidity();