summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-01-20 19:03:59 -0600
committerPhil Hughes <me@iamphill.com>2017-01-21 21:44:43 +0000
commit98dbb8e23d5d0f87d7d1c35f7249e1ff3911e640 (patch)
treeabbaa09589b5bdf60486e36144297e3341a781b5
parentf6f52b43b59641f5e0c6f7aa47b1354ca3aeee32 (diff)
downloadgitlab-ce-98dbb8e23d5d0f87d7d1c35f7249e1ff3911e640.tar.gz
Introduced an offset limit to prevent the dropdown from going far right
-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);
}