SubmitButton: scroll to top after performing action

This commit is contained in:
Philipp Czora
2019-02-20 09:47:35 +01:00
parent deedb573a6
commit 90cb047ccb

View File

@@ -4,12 +4,16 @@ import Button, { type ButtonProps } from "./Button";
class SubmitButton extends React.Component<ButtonProps> {
render() {
const { action } = this.props;
return (
<Button
type="submit"
color="primary"
{...this.props}
action={() => {
action={(event) => {
if (action) {
action(event)
}
window.scrollTo(0, 0);
}}
/>