Commit 98b1daf3 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'dropdown-enter-select' into 'master'

Fixed issue with enter key selecting wrong option in dropdown

If you search for a label and press enter the dropdown will select the last element rather than the first. This is because the currentIndex is -1 rather than 0

![labels](/uploads/eb29924109947fd63fea32e21471f05a/labels.gif)

Closes #17630

See merge request !4210
parents 9aab0f09 9f60a2ed
...@@ -512,7 +512,7 @@ class GitLabDropdown ...@@ -512,7 +512,7 @@ class GitLabDropdown
return false return false
if currentKeyCode is 13 if currentKeyCode is 13
@selectRowAtIndex currentIndex @selectRowAtIndex if currentIndex < 0 then 0 else currentIndex
removeArrayKeyEvent: -> removeArrayKeyEvent: ->
$('body').off 'keydown' $('body').off 'keydown'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment