summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-10-28 22:02:46 +0000
committerFatih Acet <acetfatih@gmail.com>2016-10-28 22:02:46 +0000
commit4d3a08036416a235873d8841a2924febc37c3414 (patch)
treee0d859d9e6dc11312f996872a77101fcdf0a1394 /app
parentdcc699afc214dab1e27541ac35a9d57ef20f2cb9 (diff)
parent3acfbcaea0aef39e257b2f6668db361fef3ac43c (diff)
downloadgitlab-ce-4d3a08036416a235873d8841a2924febc37c3414.tar.gz
Merge branch 'dropdown-input-fix' into 'master'
Do not allow text input in dropdown while loading ## What does this MR do? It moves the focus event of the text input of a filterable dropdown to after loading of options is complete. After the fix, the user cannot edit the while it's greyed out and loading. ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? It fixes the bug in https://gitlab.com/gitlab-org/gitlab-ce/issues/23496. ## Screenshots (if relevant) ![https://gitlab.com/gitlab-org/gitlab-ce/uploads/a7bc2f0228fcde5a85cccb333b52f0e3/2016-10-18_12.00.54.gif](https://gitlab.com/gitlab-org/gitlab-ce/uploads/a7bc2f0228fcde5a85cccb333b52f0e3/2016-10-18_12.00.54.gif) ## What are the relevant issue numbers? Fixes #23496 See merge request !7054
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/gl_dropdown.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js
index 1d9f641836f..98e43c4d088 100644
--- a/app/assets/javascripts/gl_dropdown.js
+++ b/app/assets/javascripts/gl_dropdown.js
@@ -239,6 +239,7 @@
this.fullData = this.options.data;
currentIndex = -1;
this.parseData(this.options.data);
+ this.focusTextInput();
} else {
this.remote = new GitLabDropdownRemote(this.options.data, {
dataType: this.options.dataType,
@@ -247,6 +248,7 @@
return function(data) {
_this.fullData = data;
_this.parseData(_this.fullData);
+ _this.focusTextInput();
if (_this.options.filterable && _this.filter && _this.filter.input) {
return _this.filter.input.trigger('input');
}
@@ -452,9 +454,8 @@
contentHtml = $('.dropdown-content', this.dropdown).html();
if (this.remote && contentHtml === "") {
this.remote.execute();
- }
- if (this.options.filterable) {
- this.filterInput.focus();
+ } else {
+ this.focusTextInput();
}
if (this.options.showMenuAbove) {
@@ -691,6 +692,10 @@
return selectedObject;
};
+ GitLabDropdown.prototype.focusTextInput = function() {
+ if (this.options.filterable) { this.filterInput.focus() }
+ }
+
GitLabDropdown.prototype.addInput = function(fieldName, value, selectedObject) {
var $input;
// Create hidden input for form