Skip to content

Commit 6ae5268

Browse files
committed
feat(dropdown): disable arrow keys
1 parent 6e24ce4 commit 6ae5268

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/dropdown/dropdown.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ export class Dropdown implements OnInit, AfterContentInit, OnDestroy {
105105
* Set to `true` for an inline dropdown.
106106
*/
107107
@Input() inline = false;
108+
/**
109+
* Set to `true` for a dropdown without arrow key activation.
110+
*/
111+
@Input() disableArrowKeys = false;
108112
/**
109113
* Deprecated. Dropdown now defaults to appending inline
110114
* Set to `true` if the `Dropdown` is to be appended to the DOM body.
@@ -303,6 +307,9 @@ export class Dropdown implements OnInit, AfterContentInit, OnDestroy {
303307
} else if (this.menuIsClosed && (event.key === " " || event.key === "ArrowDown" || event.key === "ArrowUp" ||
304308
event.key === "Spacebar" || event.key === "Down" || event.key === "Up")) {
305309
event.preventDefault();
310+
if (this.disableArrowKeys && (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Down" || event.key === "Up")) {
311+
return;
312+
}
306313
this.openMenu();
307314
}
308315

0 commit comments

Comments
 (0)