Skip to content

Commit

Permalink
prevent keyboard interaction with disabled slider.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Nov 9, 2016
1 parent 7d0d5ee commit 63f04d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,24 @@ export class MdSlider implements ControlValueAccessor {

/** Increments the slider by the given number of steps (negative number decrements. */
_increment(event: KeyboardEvent, numSteps: number) {
if (this.disabled) { return; }

this.value = this._clamp(this.value + this.step * numSteps, this.min, this.max);
event.preventDefault();
}

/** Handles end key pressed. */
_onEndKeyPressed(event: KeyboardEvent) {
if (this.disabled) { return; }

this.value = this.max;
event.preventDefault();
}

/** Handles home key pressed. */
_onHomeKeyPressed(event: KeyboardEvent) {
if (this.disabled) { return; }

this.value = this.min;
event.preventDefault();
}
Expand Down

0 comments on commit 63f04d7

Please sign in to comment.