From fb8b827c73b715cc3ee85a47c379fb0c12cf1175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Mon, 3 Aug 2026 11:36:24 -0300 Subject: [PATCH] Scroll product details to top on navigation --- src/pages/ProductDetails.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/ProductDetails.tsx b/src/pages/ProductDetails.tsx index 4900f52..0fa08c5 100644 --- a/src/pages/ProductDetails.tsx +++ b/src/pages/ProductDetails.tsx @@ -143,6 +143,15 @@ const ProductDetails = () => { const [variantCurrentPage, setVariantCurrentPage] = useState(1); const [variantItemsPerPage, setVariantItemsPerPage] = useState(5); + useEffect(() => { + const scrollContainer = document.querySelector('.app-content'); + if (scrollContainer) { + scrollContainer.scrollTo({ top: 0, behavior: 'auto' }); + } else { + window.scrollTo({ top: 0, behavior: 'auto' }); + } + }, [id]); + useEffect(() => { let isMounted = true;