Skip to content

Commit

Permalink
fix autocomplete down arrow on the last item (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ari7946 authored Jul 4, 2022
1 parent 1386427 commit b9fc687
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/packages/autocomplete/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const Autocomplete = ({
}
// User pressed the down arrow
else if (e.keyCode === 40) {
if (activeSuggestion - 1 === filteredSuggestions.length) {
if (activeSuggestion === filteredSuggestions.length - 1) {
return;
}
setActiveSuggestion(activeSuggestion + 1);
Expand Down
2 changes: 1 addition & 1 deletion src/packages/autocomplete/snippets/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function Autocomplete({
}
// User pressed the down arrow
else if (e.keyCode === 40) {
if (activeSuggestion - 1 === filteredSuggestions.length) {
if (activeSuggestion === filteredSuggestions.length - 1) {
return;
}
setActiveSuggestion(activeSuggestion + 1);
Expand Down

1 comment on commit b9fc687

@vercel
Copy link

@vercel vercel bot commented on b9fc687 Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kimia-ui – ./

kimia-ui.vercel.app
kimia-ui-git-main-enochndika.vercel.app
kimia-ui-enochndika.vercel.app

Please sign in to comment.