Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
3680612a
Commit
3680612a
authored
Jan 20, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed currentIndex being shared across dropdowns
parent
90058cf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
app/assets/javascripts/droplab/droplab.js
app/assets/javascripts/droplab/droplab.js
+9
-2
No files found.
app/assets/javascripts/droplab/droplab.js
View file @
3680612a
...
...
@@ -58,6 +58,7 @@ var CustomEvent = require('./custom_event_polyfill');
var
utils
=
require
(
'
./utils
'
);
var
DropDown
=
function
(
list
)
{
this
.
currentIndex
=
0
;
this
.
hidden
=
true
;
this
.
list
=
list
;
this
.
items
=
[];
...
...
@@ -576,7 +577,7 @@ require('./window')(function(w){
var
isUpArrow
=
false
;
var
isDownArrow
=
false
;
var
removeHighlight
=
function
removeHighlight
(
list
)
{
var
listItems
=
list
.
list
.
querySelectorAll
(
'
li
'
);
var
listItems
=
list
.
list
.
querySelectorAll
(
'
li
:not(.divider)
'
);
for
(
var
i
=
0
;
i
<
listItems
.
length
;
i
++
)
{
listItems
[
i
].
classList
.
remove
(
'
dropdown-active
'
);
}
...
...
@@ -589,7 +590,10 @@ require('./window')(function(w){
if
(
!
listItems
[
currentIndex
-
1
]){
currentIndex
=
currentIndex
-
1
;
}
listItems
[
currentIndex
-
1
].
classList
.
add
(
'
dropdown-active
'
);
if
(
listItems
[
currentIndex
-
1
])
{
listItems
[
currentIndex
-
1
].
classList
.
add
(
'
dropdown-active
'
);
}
}
};
...
...
@@ -617,6 +621,8 @@ require('./window')(function(w){
var
keydown
=
function
keydown
(
e
){
var
typedOn
=
e
.
target
;
var
dropdown
=
e
.
detail
.
hook
.
list
;
currentIndex
=
dropdown
.
currentIndex
;
isUpArrow
=
false
;
isDownArrow
=
false
;
...
...
@@ -649,6 +655,7 @@ require('./window')(function(w){
if
(
isDownArrow
){
currentIndex
++
;
}
if
(
currentIndex
<
0
){
currentIndex
=
0
;
}
setMenuForArrows
(
e
.
detail
.
hook
.
list
);
dropdown
.
currentIndex
=
currentIndex
;
};
w
.
addEventListener
(
'
mousedown.dl
'
,
mousedown
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment