typeahead: Fix buggy advanceKeyCodes code.

The `advanceKeyCodes` option was introduced in #10092.
It included a buggy check for `$.inArray` that returned
a falsey value only when the keycode was the first
element of `advanceKeyCodes`.

Because the only instance of `advanceKeyCodes` right now
is for search and contains only one element, this change
is functionally equivalent.
This commit is contained in:
evykassirer
2024-03-06 16:08:47 -08:00
committed by Tim Abbott
parent 99c119b01b
commit a55979ebf8

View File

@@ -435,7 +435,7 @@ Typeahead.prototype = {
const pseudo_keycode = get_pseudo_keycode(e);
if (
(this.options.stopAdvance || (pseudo_keycode !== 9 && pseudo_keycode !== 13)) &&
$.inArray(e.keyCode, this.options.advanceKeyCodes)
!this.options.advanceKeyCodes.includes(e.keyCode)
) {
e.stopPropagation();
}