Commit 4b7ec44b authored by Jacob Schatz's avatar Jacob Schatz

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
parents f6f52b43 98dbb8e2
...@@ -90,7 +90,15 @@ ...@@ -90,7 +90,15 @@
const input = this.filteredSearchInput; const input = this.filteredSearchInput;
const inputText = input.value.slice(0, input.selectionStart); const inputText = input.value.slice(0, input.selectionStart);
const filterIconPadding = 27; 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); this.mapping[key].reference.setOffset(offset);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment