minor: Use Array.includes instead of a regex to check for values.

This commit is contained in:
Priyank Patel 2021-06-03 14:47:14 +00:00 committed by Tim Abbott
parent 94a22f9323
commit cee94654df
1 changed files with 2 additions and 1 deletions

View File

@ -130,7 +130,8 @@ export const DropdownListWidget = function ({
search_input.on("keydown", (e) => {
const {key, keyCode, which} = e;
if (!/(ArrowUp|ArrowDown|Escape)/.test(key)) {
const navigation_keys = ["ArrowUp", "ArrowDown", "Escape"];
if (!navigation_keys.includes(key)) {
return;
}
e.preventDefault();