Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/lib/forms/BaseForm/BaseForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@
import { Form } from "semantic-ui-react";

export class BaseForm extends Component {
handleKeyDown = (event) => {
if (event.key === "Enter") {
// Prevent enter key from propagating events to other elements and from submitting the form
event.preventDefault();
}
}

Check failure on line 19 in src/lib/forms/BaseForm/BaseForm.js

View workflow job for this annotation

GitHub Actions / Tests (18.x)

Insert `;`

Check failure on line 19 in src/lib/forms/BaseForm/BaseForm.js

View workflow job for this annotation

GitHub Actions / Tests (16.x)

Insert `;`

render() {
const { formik, onSubmit, children } = this.props;
return (
<Formik onSubmit={onSubmit} {...formik}>
<Form>{children}</Form>
<Form onKeyDown={this.handleKeyDown}>{children}</Form>
</Formik>
);
}
Expand Down
Loading