Skip to content

Commit ee73cb2

Browse files
committed
fix: remove auto-scroll behavior from header navigation
- Remove window.scrollTo calls from Header component - Fix auto-scroll issue when reloading index page - Fix auto-scroll issue when clicking Foundations link - Clean up deprecated scroll logic that was causing unwanted behavior - Maintain smooth navigation without forced scrolling
1 parent 1485cad commit ee73cb2

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/components/Header.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ const Header = () => {
2929
className="flex items-center space-x-3 cursor-pointer"
3030
onClick={() => {
3131
router.push('/');
32-
setTimeout(() => {
33-
window.scrollTo({ top: 0, behavior: 'smooth' });
34-
}, 100);
3532
}}
3633
>
3734
<Logo size={32} className="text-white" />
@@ -46,15 +43,7 @@ const Header = () => {
4643
whileHover={{ y: -1 }}
4744
className="flex items-center space-x-2 text-muted-foreground hover:text-foreground transition-colors duration-150 group cursor-pointer"
4845
onClick={() => {
49-
if (item.href === '/') {
50-
// For homepage, ensure we scroll to top
51-
router.push('/');
52-
setTimeout(() => {
53-
window.scrollTo({ top: 0, behavior: 'smooth' });
54-
}, 100);
55-
} else {
56-
router.push(item.href);
57-
}
46+
router.push(item.href);
5847
}}
5948
>
6049
<item.icon className="w-4 h-4 text-white group-hover:scale-105 transition-transform duration-150" />
@@ -95,15 +84,7 @@ const Header = () => {
9584
key={item.name}
9685
onClick={() => {
9786
setIsMobileMenuOpen(false);
98-
if (item.href === '/') {
99-
// For homepage, ensure we scroll to top
100-
router.push('/');
101-
setTimeout(() => {
102-
window.scrollTo({ top: 0, behavior: 'smooth' });
103-
}, 100);
104-
} else {
105-
router.push(item.href);
106-
}
87+
router.push(item.href);
10788
}}
10889
className="flex items-center space-x-3 px-4 py-3 rounded-lg hover:bg-accent transition-colors cursor-pointer w-full text-left"
10990
>

0 commit comments

Comments
 (0)