diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-07-21 12:28:55 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-07-21 12:28:55 +0300 |
commit | 3ba8d28f31a6cdfbdfe278e83abb62ab27dd2657 (patch) | |
tree | ea73a011ebff05af40adbcf4bbcf405a53afe075 /app/assets | |
parent | 825548140c47d84a116358052891962a8ffd9b55 (diff) | |
parent | 71bb7bdf612097aa05cbd654f720d25d36598f17 (diff) |
Merge branch 'gl-dropdown-enter-key-fix' into 'master'
Fixed dropdown enter key when searching
## What does this MR do?
When searching in a dropdown you can now just press the enter key to trigger a click on the first row rather than having to press the down key & then enter.
## What are the relevant issue numbers?
Closes #19741
See merge request !5231
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js.coffee | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index 951530e03a5..7086ece29b8 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -210,9 +210,22 @@ class GitLabDropdown data: => return @fullData callback: (data) => - currentIndex = -1 @parseData data + unless @filterInput.val() is '' + selector = '.dropdown-content li:not(.divider):visible' + + if @dropdown.find('.dropdown-toggle-page').length + selector = ".dropdown-page-one #{selector}" + + $(selector, @dropdown) + .first() + .find('a') + .addClass('is-focused') + + currentIndex = 0 + + # Event listeners @dropdown.on "shown.bs.dropdown", @opened |