Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case keyMap.Tab:
if (!e.shiftKey && trapLastMenuItem(filteredRefs)) {
e.preventDefault();
setFocused(refs[0]);
refs[0].focus();
}
if (e.shiftKey && trapFirstMenuItem()) {
e.preventDefault();
filteredRefs[filteredRefs.length - 1].focus();
setFocused(filteredRefs[filteredRefs.length - 1]);
}
break;
case keyMap.Space:
case keyMap.Enter:
if (!open) {
setFocused(refs[0]);
refs[0].focus();
}
break;
}
}