Skip to content

Commit 6e24ce4

Browse files
committed
feat(slider): disable arrow keys
1 parent 23bae4f commit 6e24ce4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/slider/slider.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ export class Slider implements AfterViewInit, OnDestroy, ControlValueAccessor {
149149
@Input() shiftMultiplier = 4;
150150
/** Set to `true` for a loading slider */
151151
@Input() skeleton = false;
152+
/** Set to `true` for a slider without arrow key interactions. */
153+
@Input() disableArrowKeys = false;
152154
/** Disables the range visually and functionally */
153155
@Input() set disabled(v) {
154156
this._disabled = v;
@@ -338,6 +340,9 @@ export class Slider implements AfterViewInit, OnDestroy, ControlValueAccessor {
338340

339341
/** Calls `incrementValue` for ArrowRight and ArrowUp, `decrementValue` for ArrowLeft and ArrowDown */
340342
onKeyDown(event: KeyboardEvent) {
343+
if (this.disableArrowKeys) {
344+
return;
345+
}
341346
event.preventDefault();
342347
const multiplier = event.shiftKey ? this.shiftMultiplier : 1;
343348
if (event.key === "ArrowLeft" || event.key === "ArrowDown") {

0 commit comments

Comments
 (0)