Skip to content

Commit f72feeb

Browse files
author
bthos
committed
Refine header navigation behavior to enhance user experience
- Updated the home click handler to scroll to the top without modifying the URL, preserving the base path. - Improved comments for clarity on navigation behavior when already on the home page.
1 parent c475e13 commit f72feeb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

website/src/components/Header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ const Header: FC = () => {
1313
const handleHomeClick = (e: React.MouseEvent) => {
1414
setIsMenuOpen(false);
1515

16-
// If we're already on the home page, scroll to top
16+
// If we're already on the home page, scroll to top without changing URL
1717
if (location.pathname === '/' || location.pathname === '') {
1818
e.preventDefault();
19-
window.history.replaceState(null, '', '/');
19+
// Just scroll to top, don't modify URL to preserve base path
2020
window.scrollTo({ top: 0, behavior: 'smooth' });
2121
}
22-
// Otherwise, Link component will handle navigation
22+
// Otherwise, Link component will handle navigation correctly
2323
};
2424

2525
const handleSectionClick = (id: string, e: React.MouseEvent) => {

0 commit comments

Comments
 (0)