mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-05 16:42:29 +03:00
Fix crash when pressing ArrowUp the first time
This commit is contained in:
+4
-1
@@ -479,7 +479,7 @@ class Dropdown {
|
||||
return
|
||||
}
|
||||
|
||||
let index = items.indexOf(event.target) || 0
|
||||
let index = items.indexOf(event.target)
|
||||
|
||||
if (event.key === ARROW_UP_KEY && index > 0) { // Up
|
||||
index--
|
||||
@@ -489,6 +489,9 @@ class Dropdown {
|
||||
index++
|
||||
}
|
||||
|
||||
// index is -1 if the first keydown is an ArrowUp
|
||||
index = index === -1 ? 0 : index
|
||||
|
||||
items[index].focus()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user