summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2017-01-21 23:14:36 +0000
committerJacob Schatz <jschatz@gitlab.com>2017-01-21 23:14:36 +0000
commit4b7ec44b91e0571d209c790d54947ba1756dac0e (patch)
treeabbaa09589b5bdf60486e36144297e3341a781b5
parentf6f52b43b59641f5e0c6f7aa47b1354ca3aeee32 (diff)
parent98dbb8e23d5d0f87d7d1c35f7249e1ff3911e640 (diff)
downloadgitlab-ce-4b7ec44b91e0571d209c790d54947ba1756dac0e.tar.gz
Merge branch '26618-search-bar-dropdown-offset-should-not-go-past-search-bar-input' into 'master'
Introduced an offset limit to prevent the dropdown from going far right Closes #26618 and #27023 See merge request !8679
-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);
}