diff options
Diffstat (limited to 'js/src/util/index.js')
-rw-r--r-- | js/src/util/index.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/js/src/util/index.js b/js/src/util/index.js index 77bdc072fc..4d077b21f9 100644 --- a/js/src/util/index.js +++ b/js/src/util/index.js @@ -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 |