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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a4b411b0
Commit
a4b411b0
authored
Mar 17, 2021
by
Simon Stieger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close DropLab dropdowns on click instead of mousedown
parent
bf0e082a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
app/assets/javascripts/droplab/drop_lab.js
app/assets/javascripts/droplab/drop_lab.js
+9
-6
app/assets/javascripts/droplab/hook_button.js
app/assets/javascripts/droplab/hook_button.js
+2
-0
changelogs/unreleased/close-droplab-dropdowns-on-click.yml
changelogs/unreleased/close-droplab-dropdowns-on-click.yml
+5
-0
No files found.
app/assets/javascripts/droplab/drop_lab.js
View file @
a4b411b0
...
...
@@ -60,21 +60,24 @@ class DropLab {
addEvents
()
{
this
.
eventWrapper
.
documentClicked
=
this
.
documentClicked
.
bind
(
this
);
document
.
addEventListener
(
'
mousedown
'
,
this
.
eventWrapper
.
documentClicked
);
document
.
addEventListener
(
'
click
'
,
this
.
eventWrapper
.
documentClicked
);
}
documentClicked
(
e
)
{
let
thisTag
=
e
.
target
;
if
(
e
.
defaultPrevented
)
return
;
if
(
thisTag
.
tagName
!==
'
UL
'
)
thisTag
=
utils
.
closest
(
thisTag
,
'
UL
'
);
if
(
utils
.
isDropDownParts
(
thisTag
,
this
.
hooks
))
return
;
if
(
utils
.
isDropDownParts
(
e
.
target
,
this
.
hooks
))
return
;
if
(
utils
.
isDropDownParts
(
e
.
target
))
return
;
if
(
e
.
target
.
tagName
!==
'
UL
'
)
{
const
closestUl
=
utils
.
closest
(
e
.
target
,
'
UL
'
);
if
(
utils
.
isDropDownParts
(
closestUl
))
return
;
}
this
.
hooks
.
forEach
((
hook
)
=>
hook
.
list
.
hide
());
}
removeEvents
()
{
document
.
removeEventListener
(
'
mousedown
'
,
this
.
eventWrapper
.
documentClicked
);
document
.
removeEventListener
(
'
click
'
,
this
.
eventWrapper
.
documentClicked
);
}
changeHookList
(
trigger
,
list
,
plugins
,
config
)
{
...
...
app/assets/javascripts/droplab/hook_button.js
View file @
a4b411b0
...
...
@@ -18,6 +18,8 @@ class HookButton extends Hook {
}
clicked
(
e
)
{
e
.
preventDefault
();
const
buttonEvent
=
new
CustomEvent
(
'
click.dl
'
,
{
detail
:
{
hook
:
this
,
...
...
changelogs/unreleased/close-droplab-dropdowns-on-click.yml
0 → 100644
View file @
a4b411b0
---
title
:
Close DropLab dropdowns on click instead of mousedown
merge_request
:
56847
author
:
Simon Stieger @sim0
type
:
fixed
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