Commit b3179451 authored by Jacob Schatz's avatar Jacob Schatz Committed by Yorick Peterse

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
parent d5640394
...@@ -460,7 +460,7 @@ class GitLabDropdown ...@@ -460,7 +460,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