mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-08 14:46:34 +02:00
Fix crash when pressing ArrowUp the first time
This commit is contained in:
@@ -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