Skip to content

Commit a643ea1

Browse files
dreamofabeartohosaku
authored andcommitted
fix: array index out of bounds on enter key event zurb#773
On enter, don't select when filteredItems is empty
1 parent 541e4b2 commit a643ea1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/TributeEvents.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ class TributeEvents {
230230
},
231231
enter: (e, el) => {
232232
// choose selection
233-
if (this.tribute.isActive && this.tribute.current.filteredItems) {
233+
const filteredItems = this.tribute.current.filteredItems;
234+
if (this.tribute.isActive && filteredItems && filteredItems.length) {
234235
e.preventDefault();
235236
e.stopPropagation();
236237
setTimeout(() => {

0 commit comments

Comments
 (0)