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:
AmirReza Jamali
2025-11-05 12:47:53 +03:30
parent b18aa8eb71
commit ad93236594
+6
View File
@@ -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 (