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
dfa4a440
Commit
dfa4a440
authored
Jun 08, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed dropdown filter input not focusing after transition
Closes #33216
parent
fd072e22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+15
-3
changelogs/unreleased/issuable-sidebar-edit-button-field-focus.yml
...s/unreleased/issuable-sidebar-edit-button-field-focus.yml
+4
-0
spec/javascripts/gl_dropdown_spec.js
spec/javascripts/gl_dropdown_spec.js
+3
-1
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
dfa4a440
...
@@ -248,7 +248,7 @@ GitLabDropdown = (function() {
...
@@ -248,7 +248,7 @@ GitLabDropdown = (function() {
return
function
(
data
)
{
return
function
(
data
)
{
_this
.
fullData
=
data
;
_this
.
fullData
=
data
;
_this
.
parseData
(
_this
.
fullData
);
_this
.
parseData
(
_this
.
fullData
);
_this
.
focusTextInput
();
_this
.
focusTextInput
(
true
);
if
(
_this
.
options
.
filterable
&&
_this
.
filter
&&
_this
.
filter
.
input
&&
_this
.
filter
.
input
.
val
()
&&
_this
.
filter
.
input
.
val
().
trim
()
!==
''
)
{
if
(
_this
.
options
.
filterable
&&
_this
.
filter
&&
_this
.
filter
.
input
&&
_this
.
filter
.
input
.
val
()
&&
_this
.
filter
.
input
.
val
().
trim
()
!==
''
)
{
return
_this
.
filter
.
input
.
trigger
(
'
input
'
);
return
_this
.
filter
.
input
.
trigger
(
'
input
'
);
}
}
...
@@ -728,8 +728,20 @@ GitLabDropdown = (function() {
...
@@ -728,8 +728,20 @@ GitLabDropdown = (function() {
return
[
selectedObject
,
isMarking
];
return
[
selectedObject
,
isMarking
];
};
};
GitLabDropdown
.
prototype
.
focusTextInput
=
function
()
{
GitLabDropdown
.
prototype
.
focusTextInput
=
function
(
triggerFocus
=
false
)
{
if
(
this
.
options
.
filterable
)
{
this
.
filterInput
.
focus
();
}
if
(
this
.
options
.
filterable
)
{
$
(
'
:focus
'
).
blur
();
this
.
dropdown
.
one
(
'
transitionend
'
,
()
=>
{
this
.
filterInput
.
focus
();
});
if
(
triggerFocus
)
{
// This triggers after a ajax request
// in case of slow requests, the dropdown transition could already be finished
this
.
dropdown
.
trigger
(
'
transitionend
'
);
}
}
};
};
GitLabDropdown
.
prototype
.
addInput
=
function
(
fieldName
,
value
,
selectedObject
)
{
GitLabDropdown
.
prototype
.
addInput
=
function
(
fieldName
,
value
,
selectedObject
)
{
...
...
changelogs/unreleased/issuable-sidebar-edit-button-field-focus.yml
0 → 100644
View file @
dfa4a440
---
title
:
Fixed dropdown filter input not focusing after transition
merge_request
:
author
:
spec/javascripts/gl_dropdown_spec.js
View file @
dfa4a440
...
@@ -185,7 +185,7 @@ import '~/lib/utils/url_utility';
...
@@ -185,7 +185,7 @@ import '~/lib/utils/url_utility';
expect
(
$
(
document
.
activeElement
)).
toEqual
(
$
(
SEARCH_INPUT_SELECTOR
));
expect
(
$
(
document
.
activeElement
)).
toEqual
(
$
(
SEARCH_INPUT_SELECTOR
));
});
});
it
(
'
should focus on input when opening for the second time
'
,
()
=>
{
it
(
'
should focus on input when opening for the second time
after transition
'
,
()
=>
{
remoteCallback
();
remoteCallback
();
this
.
dropdownContainerElement
.
trigger
({
this
.
dropdownContainerElement
.
trigger
({
type
:
'
keyup
'
,
type
:
'
keyup
'
,
...
@@ -193,6 +193,7 @@ import '~/lib/utils/url_utility';
...
@@ -193,6 +193,7 @@ import '~/lib/utils/url_utility';
keyCode
:
ARROW_KEYS
.
ESC
keyCode
:
ARROW_KEYS
.
ESC
});
});
this
.
dropdownButtonElement
.
click
();
this
.
dropdownButtonElement
.
click
();
this
.
dropdownContainerElement
.
trigger
(
'
transitionend
'
);
expect
(
$
(
document
.
activeElement
)).
toEqual
(
$
(
SEARCH_INPUT_SELECTOR
));
expect
(
$
(
document
.
activeElement
)).
toEqual
(
$
(
SEARCH_INPUT_SELECTOR
));
});
});
});
});
...
@@ -201,6 +202,7 @@ import '~/lib/utils/url_utility';
...
@@ -201,6 +202,7 @@ import '~/lib/utils/url_utility';
it
(
'
should focus input when passing array data to drop down
'
,
()
=>
{
it
(
'
should focus input when passing array data to drop down
'
,
()
=>
{
initDropDown
.
call
(
this
,
false
,
true
);
initDropDown
.
call
(
this
,
false
,
true
);
this
.
dropdownButtonElement
.
click
();
this
.
dropdownButtonElement
.
click
();
this
.
dropdownContainerElement
.
trigger
(
'
transitionend
'
);
expect
(
$
(
document
.
activeElement
)).
toEqual
(
$
(
SEARCH_INPUT_SELECTOR
));
expect
(
$
(
document
.
activeElement
)).
toEqual
(
$
(
SEARCH_INPUT_SELECTOR
));
});
});
});
});
...
...
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