From 397622c4610026fe79c6dd60147769a949f6682a Mon Sep 17 00:00:00 2001 From: Miguel Cerejo Date: Fri, 6 Oct 2023 18:15:56 +0100 Subject: [PATCH] Fix array index out of bounds on enter key event #773 --- src/TributeEvents.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TributeEvents.js b/src/TributeEvents.js index 95dc7f80..a107ba12 100644 --- a/src/TributeEvents.js +++ b/src/TributeEvents.js @@ -228,7 +228,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(() => {