From ad9323659402b6c51aaa12f7881c86d1f7b13695 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Wed, 5 Nov 2025 12:47:53 +0330 Subject: [PATCH] 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. --- src/components/ui/Stepper.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/ui/Stepper.tsx b/src/components/ui/Stepper.tsx index 0e0ee71..93bbe61 100644 --- a/src/components/ui/Stepper.tsx +++ b/src/components/ui/Stepper.tsx @@ -40,6 +40,9 @@ const Stepper: React.FC = ({ setInternalStep(newStep); } } + if (window) { + window.scroll({ top: 0, behavior: "smooth" }); + } }; const prevStep = () => { @@ -51,6 +54,9 @@ const Stepper: React.FC = ({ setInternalStep(newStep); } } + if (window) { + window.scroll({ top: 0, behavior: "smooth" }); + } }; return (