Skip to content

Commit

Permalink
fix(typeahead): ArrowUp on last item should not reset highlighted ind…
Browse files Browse the repository at this point in the history
…ex (#42)

Fixes #41
  • Loading branch information
elimisteve committed Mar 20, 2022
1 parent cf484ac commit 6d63028
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Typeahead.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
/** @type {(direction: -1 | 1) => void} */
function change(direction) {
let index =
selectedIndex === results.length - 1 ? 0 : selectedIndex + direction;
direction === 1 && selectedIndex === results.length - 1 ? 0 : selectedIndex + direction;
if (index < 0) index = results.length - 1;
let disabled = results[index].disabled;
Expand Down

0 comments on commit 6d63028

Please sign in to comment.