Skip to content

Commit

Permalink
fix: array index out of bounds on enter key event zurb#773
Browse files Browse the repository at this point in the history
On enter, don't select when filteredItems is empty
  • Loading branch information
dreamofabear authored and tohosaku committed Aug 12, 2024
1 parent 541e4b2 commit a643ea1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/TributeEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ class TributeEvents {
},
enter: (e, el) => {
// choose selection
if (this.tribute.isActive && this.tribute.current.filteredItems) {
const filteredItems = this.tribute.current.filteredItems;
if (this.tribute.isActive && filteredItems && filteredItems.length) {
e.preventDefault();
e.stopPropagation();
setTimeout(() => {
Expand Down

0 comments on commit a643ea1

Please sign in to comment.