mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-29 23:09:05 +02:00
Automatically select an item in the dropdown when using arrow keys (#34052)
This commit is contained in:
@@ -264,9 +264,9 @@ const execute = callback => {
|
||||
const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
|
||||
let index = list.indexOf(activeElement)
|
||||
|
||||
// if the element does not exist in the list initialize it as the first element
|
||||
// if the element does not exist in the list return an element depending on the direction and if cycle is allowed
|
||||
if (index === -1) {
|
||||
return list[0]
|
||||
return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0]
|
||||
}
|
||||
|
||||
const listLength = list.length
|
||||
|
Reference in New Issue
Block a user