Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _onTextFieldKeyDown = (ev: React.KeyboardEvent): void => {
switch (ev.which) {
case KeyCodes.enter:
ev.preventDefault();
ev.stopPropagation();
if (!this.state.isDatePickerShown) {
this._validateTextInput();
this._showDatePickerPopup();
} else {
// When DatePicker allows input date string directly,
// it is expected to hit another enter to close the popup
if (this.props.allowTextInput) {
this._dismissDatePickerPopup();
}
}
break;
case KeyCodes.escape:
this._handleEscKey(ev);
return (ev: React.KeyboardEvent): void => {
if (ev.which === KeyCodes.enter) {
this._onSelectDate(originalDate);
} else {
this._navigateMonthEdge(ev, originalDate, weekIndex, dayIndex);
}
};
};
return (ev: React.KeyboardEvent) => {
switch (ev.which) {
case KeyCodes.enter:
callback();
break;
}
};
};
return (ev: React.KeyboardEvent) => {
switch (ev.which) {
case KeyCodes.enter:
case KeyCodes.space:
callback();
break;
}
};
};
this._root.current && (this._root.current.lastChild as HTMLElement | null)
if (
this._root.current &&
this.focusElement(getPreviousElement(
this._root.current,
lastChild,
true,
true,
true,
) as HTMLElement)
) {
break
}
return
case KeyCodes.enter:
if (this.tryInvokeClickForFocusable(ev.target as HTMLElement)) {
break
}
return
default:
return
}
}
ev.preventDefault()
ev.stopPropagation()
}
return (ev: React.KeyboardEvent) => {
switch (ev.which) {
case KeyCodes.enter:
callback();
break;
}
};
};
return (ev: React.KeyboardEvent) => {
switch (ev.which) {
case KeyCodes.enter:
callback();
break;
}
};
};