tribute icon indicating copy to clipboard operation
tribute copied to clipboard

Fix array index out of bounds on enter key event

Open dreamofabear opened this issue 2 years ago • 0 comments

On keyboard enter, don't select when filteredItems is empty.

If filteredItems is empty array here: https://github.com/zurb/tribute/blob/252ec344a75b624268aef1cdbf80afc30b3cbe2b/src/TributeEvents.js#L226-L230

Then item will be undefined here: https://github.com/zurb/tribute/blob/252ec344a75b624268aef1cdbf80afc30b3cbe2b/src/Tribute.js#L473-L479

I noticed this when hitting the enter key on strings that don't match any values but coincidentally contain my trigger character, e.g. : in hyperlinks.

dreamofabear avatar Mar 14 '22 20:03 dreamofabear