From 98dbb8e23d5d0f87d7d1c35f7249e1ff3911e640 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Fri, 20 Jan 2017 19:03:59 -0600 Subject: Introduced an offset limit to prevent the dropdown from going far right --- .../filtered_search/filtered_search_dropdown_manager.js.es6 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/assets') 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); } -- cgit v1.2.3