Skip to content

Commit

Permalink
Make scroll up absolute (#2313)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadmsaadaot authored Oct 12, 2023
1 parent a627ff2 commit dd7839c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions met-web/src/components/Form/MultiPageForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState, useRef } from 'react';
import React, { useState } from 'react';
import { Form } from '@formio/react';
import { FormSubmissionData, FormSubmitterProps } from './types';
import FormStepper from 'components/survey/submit/Stepper';

interface PageData {
page: number;
submission: unknown;
Expand All @@ -10,19 +11,15 @@ interface PageData {
const MultiPageForm = ({ handleFormChange, savedForm, handleFormSubmit }: FormSubmitterProps) => {
const [currentPage, setCurrentPage] = useState(0);

const stepperRef = useRef<HTMLDivElement>(null);

const handleScrollUp = () => {
if (stepperRef.current) {
stepperRef.current.scrollIntoView({
behavior: 'smooth',
block: 'end',
});
}
window.scrollTo({
top: 100,
behavior: 'smooth',
});
};

return (
<div className="formio" ref={stepperRef}>
<div className="formio">
<FormStepper currentPage={currentPage} pages={savedForm?.components ?? []} />
<Form
form={savedForm || { display: 'wizard' }}
Expand Down

0 comments on commit dd7839c

Please sign in to comment.