-
Notifications
You must be signed in to change notification settings - Fork 172
Closed
Description
I have a page with a table of contents, HTML looks something like this:
<article>
<h1 id="one">...</h1>
<h2 id="two">...</h2>
<h2 id="three">...</h2>
</article>
Table of Contents
<ol>
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li><a href="#three">three</a></li>
</ol>I'm rendering the HTML with template like this, though i did try plain <a> tags
<For each={tableOfContents()}>
{({ id, text }) => (
<li>
<Link href={`#${id}`}>{text}</Link>
</li>
)}
</For>theses are hash links to items on the same page/route. they appear to make the page scroll to the top, rather than to the item within the page. I'm not entirely sure what the issue is but I did fix the issue by tricking the anchor click method. i added taget="_self" to the anchor so the click handler early returns and browser default behavior takes over.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels