Skip to content

Commit 5c49ed8

Browse files
committed
Complete to currently selected suggestion.
When hitting right (RTL) or left (LTR), rather than simply completing to the top suggestion, if the user has navigated down to a suggestion, use it. Fall back to the first suggestion if they haven't.
1 parent b46224c commit 5c49ed8

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

dist/typeahead.bundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,12 +2068,12 @@
20682068
},
20692069
_onLeftKeyed: function onLeftKeyed() {
20702070
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
2071-
this.autocomplete(this.menu.getTopSelectable());
2071+
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
20722072
}
20732073
},
20742074
_onRightKeyed: function onRightKeyed() {
20752075
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
2076-
this.autocomplete(this.menu.getTopSelectable());
2076+
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
20772077
}
20782078
},
20792079
_onQueryChanged: function onQueryChanged(e, query) {

dist/typeahead.bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/typeahead.jquery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,12 +1145,12 @@
11451145
},
11461146
_onLeftKeyed: function onLeftKeyed() {
11471147
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
1148-
this.autocomplete(this.menu.getTopSelectable());
1148+
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
11491149
}
11501150
},
11511151
_onRightKeyed: function onRightKeyed() {
11521152
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
1153-
this.autocomplete(this.menu.getTopSelectable());
1153+
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
11541154
}
11551155
},
11561156
_onQueryChanged: function onQueryChanged(e, query) {

dist/typeahead.jquery.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/typeahead/typeahead.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ var Typeahead = (function() {
192192

193193
_onLeftKeyed: function onLeftKeyed() {
194194
if (this.dir === 'rtl' && this.input.isCursorAtEnd()) {
195-
this.autocomplete(this.menu.getTopSelectable());
195+
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
196196
}
197197
},
198198

199199
_onRightKeyed: function onRightKeyed() {
200200
if (this.dir === 'ltr' && this.input.isCursorAtEnd()) {
201-
this.autocomplete(this.menu.getTopSelectable());
201+
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
202202
}
203203
},
204204

0 commit comments

Comments
 (0)