Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): void => {
const rowCount: number = Object.keys(this.editData).length;
switch (event.keyCode) {
case KeyCodes.enter:
if (rowIndex < rowCount - 1) {
// focus on the next row
this.focusOnRow(rowIndex + 1);
event.preventDefault();
} else if (this.editData[rowKey] !== "") {
// create a new row if the current one is valid
this.createRow(rowCount);
event.preventDefault();
}
return;
case KeyCodes.tab:
if (
!event.shiftKey &&
rowIndex === rowCount - 1 &&
this.editData[rowKey] !== ""
) {
// create a new row if the current one is valid
this.createRow(rowCount);
event.preventDefault();
}
return;
}
};
private handleChildrenListInputKeydown = (
e: React.KeyboardEvent
): void => {
switch (e.keyCode) {
case KeyCodes.enter:
e.preventDefault();
case KeyCodes.tab:
if (this.state.childrenSearchTerm !== "") {
this.onAddComponent(
this.state.filteredChildOptions[
this.state.indexOfSelectedFilteredChildOption
]
);
}
this.setState({
hideChildrenList: true,
});
break;
case KeyCodes.arrowUp:
this.selectPreviousFilteredChildOption();
break;
case KeyCodes.arrowDown: