From 7866a8577a16f0e522a1d937b2789d68ac554446 Mon Sep 17 00:00:00 2001 From: Jordan Ramos Date: Wed, 24 Jun 2026 17:52:37 -0600 Subject: [PATCH] =?UTF-8?q?Fix=20User=20Guide=20TOC=20=E2=80=94=20add=20he?= =?UTF-8?q?ading=20IDs=20and=20smooth=20scroll=20anchor=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Headings now render with id attributes derived from their text so TOC anchor links (#getting-started, etc.) have targets. Internal anchor clicks use scrollIntoView with smooth behavior instead of full page navigation. --- frontend/src/components/UserGuideModal.js | 35 +++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/UserGuideModal.js b/frontend/src/components/UserGuideModal.js index 123b93d..cdac66c 100644 --- a/frontend/src/components/UserGuideModal.js +++ b/frontend/src/components/UserGuideModal.js @@ -145,9 +145,38 @@ export default function UserGuideModal({ isOpen, onClose }) { ) : (

{children}

, - h2: ({ children }) =>

{children}

, - h3: ({ children }) =>

{children}

, + h1: ({ children }) => { + const id = String(children).toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, ''); + return

{children}

; + }, + h2: ({ children }) => { + const id = String(children).toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, ''); + return

{children}

; + }, + h3: ({ children }) => { + const id = String(children).toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, ''); + return

{children}

; + }, + a: ({ href, children }) => { + // Handle internal anchor links — scroll within the modal + if (href && href.startsWith('#')) { + return ( + { + e.preventDefault(); + const targetId = href.slice(1); + const el = document.getElementById(targetId); + if (el) el.scrollIntoView({ behavior: 'smooth', block: 'start' }); + }} + style={{ color: '#7DD3FC', textDecoration: 'none', borderBottom: '1px solid rgba(125,211,252,0.3)' }} + > + {children} + + ); + } + return {children}; + }, p: ({ children }) =>

{children}

, li: ({ children }) =>
  • {children}
  • , ul: ({ children }) => ,