summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFaris Ansari <netchampfaris@users.noreply.github.com>2016-12-13 00:49:47 +0530
committerLea Verou <lea@verou.me>2016-12-12 21:19:47 +0200
commitba6a1fc01e172fc095f73f27aceb022dbccb56f0 (patch)
treea9efa5a511c62842b4f3715bd478a3f8e6e32141
parent8185a3c51433e1ce8a24c0c6d3bf63dcfd2bc41f (diff)
downloadawesomplete-ba6a1fc01e172fc095f73f27aceb022dbccb56f0.zip
awesomplete-ba6a1fc01e172fc095f73f27aceb022dbccb56f0.tar.gz
awesomplete-ba6a1fc01e172fc095f73f27aceb022dbccb56f0.tar.bz2
Scroll to highlighted element when list container height is fixed (#17025)HEADorigin/gh-pagesorigin/HEADgh-pages
-rw-r--r--awesomplete.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/awesomplete.js b/awesomplete.js
index 4a0e7e8..f8866f7 100644
--- a/awesomplete.js
+++ b/awesomplete.js
@@ -197,6 +197,9 @@ _.prototype = {
lis[i].setAttribute("aria-selected", "true");
this.status.textContent = lis[i].textContent;
+ // scroll to highlighted element in case parent's height is fixed
+ this.ul.scrollTop = lis[i].offsetTop - this.ul.clientHeight + lis[i].clientHeight;
+
$.fire(this.input, "awesomplete-highlight", {
text: this.suggestions[this.index]
});