feat(stepper): add scroll to top on step change
When navigating between steps, the new content could appear below the fold, requiring the user to scroll up manually. This change introduces an automatic smooth scroll to the top of the page whenever the user navigates to the next or previous step. This improves the user experience by ensuring the start of the new step's content is always visible.
This commit is contained in:
@@ -40,6 +40,9 @@ const Stepper: React.FC<StepperProps> = ({
|
||||
setInternalStep(newStep);
|
||||
}
|
||||
}
|
||||
if (window) {
|
||||
window.scroll({ top: 0, behavior: "smooth" });
|
||||
}
|
||||
};
|
||||
|
||||
const prevStep = () => {
|
||||
@@ -51,6 +54,9 @@ const Stepper: React.FC<StepperProps> = ({
|
||||
setInternalStep(newStep);
|
||||
}
|
||||
}
|
||||
if (window) {
|
||||
window.scroll({ top: 0, behavior: "smooth" });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user