Skip to content

Commit ea313a2

Browse files
committed
fix: restrict keyboard navigation to ArrowDown and ArrowUp keys in listbox
Signed-off-by: Parth Raiyani <[email protected]> Change-Id: I96ff2acedae0928deaf46a8fcb86705e11da4c4a
1 parent 2b84305 commit ea313a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

browser/src/control/jsdialog/Util.KeyboardListNavigation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ function focusFirstListBoxItem(listboxElement: HTMLElement) {
8282

8383
JSDialog.KeyboardListNavigation = function (container: HTMLElement) {
8484
container.addEventListener('keydown', (event: KeyboardEvent) => {
85+
86+
const allowedKeys = ['ArrowDown', 'ArrowUp'];
87+
if (!allowedKeys.includes(event.key)) {
88+
return;
89+
}
90+
8591
const activeElement = document.activeElement as HTMLElement;
8692
const activeElementRole = activeElement.getAttribute('role');
8793

0 commit comments

Comments
 (0)