diff --git a/frontend/src/components/layout/AppHeader.tsx b/frontend/src/components/layout/AppHeader.tsx index 27221350..aca0e36e 100644 --- a/frontend/src/components/layout/AppHeader.tsx +++ b/frontend/src/components/layout/AppHeader.tsx @@ -104,8 +104,12 @@ export const AppHeader: React.FC = ({ editorMenu, editorToolbar return null; } + // Compare with the trailing slash ignored: /editor is served (and + // canonicalized) as /editor/ since it is prerendered, while client-side + // navigation still lands on /editor. + const samePath = (a: string, b: string) => a.replace(/\/+$/, '') === b.replace(/\/+$/, ''); const isActive = (path: string) => - location.pathname === localize(path) ? ' header-nav-link-active' : ''; + samePath(location.pathname, localize(path)) ? ' header-nav-link-active' : ''; return (
@@ -159,7 +163,7 @@ export const AppHeader: React.FC = ({ editorMenu, editorToolbar {t('header.nav.examples')} - + {t('header.nav.editor')} {import.meta.env.VITE_PRO_BUILD && ( @@ -243,7 +247,7 @@ export const AppHeader: React.FC = ({ editorMenu, editorToolbar {/* Share button — visible when a project is loaded */} - {currentProject && location.pathname === '/editor' && ( + {currentProject && samePath(location.pathname, localize('/editor')) && (