Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onKeyDown: callAllEventHandlers(onKeyDown, event => {
const key = getKeyName(event);
if (includes(SPECIAL_INPUT_KEYS, key)) {
actions.inputSpecialKeyDown(createKeyDownPayload(event, key, disabled.current));
event.preventDefault();
}
}),
// TODO test this blur handler.
private fireAllEvents({ options, typing = false }: OptionsWithTypingParams) {
this.keyDown({ options });
if (
!includes(noKeyPress, options.key) ||
(typing && isUSKeyboardCharacter(options.key) && usKeyboardLayout[options.key].text)
) {
this.keyPress({ options });
}
if (!includes(noKeyUp, options.key)) {
this.keyUp({ options });
}
return this;
}
private fireAllEvents({ options, typing = false }: OptionsWithTypingParams) {
this.keyDown({ options });
if (
!includes(noKeyPress, options.key) ||
(typing && isUSKeyboardCharacter(options.key) && usKeyboardLayout[options.key].text)
) {
this.keyPress({ options });
}
if (!includes(noKeyUp, options.key)) {
this.keyUp({ options });
}
return this;
}
onKeyDown: callAllEventHandlers(onKeyDown, event => {
const key = getKeyName(event);
if (isInternalEvent(event)) {
return;
}
if (includes(SPECIAL_TOGGLE_BUTTON_KEYS, key)) {
actions.toggleButtonSpecialKeyDown(createKeyDownPayload(event, key, disabled.current));
event.preventDefault();
}
}),
onBlur: callAllEventHandlers(onBlur, event => {
onKeyDown: callAllEventHandlers(onKeyDown, event => {
const key = getKeyName(event);
if (includes(SPECIAL_MENU_KEYS, key)) {
actions.menuSpecialKeyDown(createKeyDownPayload(event, key, disabled.current));
if (key !== 'Tab') {
event.preventDefault();
}
} else if (isValidCharacterKey(key)) {
actions.menuCharacterKeyDown(key);
}
}),
onBlur: callAllEventHandlers(onBlur, event => {