scottdarby / Stylish-Select

*No longer maintained* A cross-browser, accessible alternative to the standard form select element which can be fully customised with CSS
122 stars 50 forks source link

added condition on keypress event #53

Closed ptchccnt2015 closed 5 years ago

ptchccnt2015 commented 5 years ago

adding this condition to catch if the currentKeyIndex is greater than or equal to 0 so that the logic inside won't execute

scenario: My list has

so my keys are ['s', 'a', 'm', 'z']

but when I press other keys that isn't in the list the logic still executes and selected the index 1 or the 2nd item in the list

and when I added currentKeyIndex >= 0 in line 356 the logic only runs when I press 's', 'a', 'm' or 'z'

I hope this will be approved or you could give me some workaround

thanks