Skip to content

Commit

Permalink
fix(timepicker): Noisy cursor movements on arrow keys (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
RistiCore authored and pimenovoleg committed Oct 29, 2018
1 parent d1857fa commit 0513bc5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/timepicker/timepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

(<FormControl> this.ngControl.control).updateValueAndValidity();
Expand Down

0 comments on commit 0513bc5

Please sign in to comment.