Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-01-21 04:03:59 +0300
committerPhil Hughes <me@iamphill.com>2017-01-22 00:44:43 +0300
commit98dbb8e23d5d0f87d7d1c35f7249e1ff3911e640 (patch)
treeabbaa09589b5bdf60486e36144297e3341a781b5 /app/assets
parentf6f52b43b59641f5e0c6f7aa47b1354ca3aeee32 (diff)
Introduced an offset limit to prevent the dropdown from going far right
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es610
1 files changed, 9 insertions, 1 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6 b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
index 04873115580..408a0dfd768 100644
--- a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
+++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
@@ -90,7 +90,15 @@
const input = this.filteredSearchInput;
const inputText = input.value.slice(0, input.selectionStart);
const filterIconPadding = 27;
- const offset = gl.text.getTextWidth(inputText, this.font) + filterIconPadding;
+ let offset = gl.text.getTextWidth(inputText, this.font) + filterIconPadding;
+
+ const currentDropdownWidth = this.mapping[key].element.clientWidth === 0 ? 200 :
+ this.mapping[key].element.clientWidth;
+ const offsetMaxWidth = this.filteredSearchInput.clientWidth - currentDropdownWidth;
+
+ if (offsetMaxWidth < offset) {
+ offset = offsetMaxWidth;
+ }
this.mapping[key].reference.setOffset(offset);
}