diff options
author | Ido Leibovich <ileibovich@yotpo.com> | 2016-10-22 18:46:53 +0300 |
---|---|---|
committer | Ido Leibovich <ileibovich@yotpo.com> | 2016-10-28 23:26:33 +0300 |
commit | 3acfbcaea0aef39e257b2f6668db361fef3ac43c (patch) | |
tree | c38c1c01cfa82b2eacd1db49a026d279d871d88a /app | |
parent | f4fed44f6700aed93015dfeac0ade00a93e8288d (diff) | |
download | gitlab-ce-3acfbcaea0aef39e257b2f6668db361fef3ac43c.tar.gz |
Do not allow text input in dropdown while loading
While loading, the entire dropdown is greyed out. However, The focus is on the text input, so user can input text. Move the focus event to after loading finished to fix this.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 11 |
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 |