Search code examples
htmltapestrytableofcontents

HTML TOC does not work on page refresh


I'm setting up a simple HTML TOC which scrolls to the correct content id while clicking a url like this <a href="#example_toc">Example TOC</a>. The TOC appends to the url like so

https://www.example.com/#example_toc

Now if I refresh the browser with the TOC appended the url, it doesn't scroll to the content. What could possible break this?

I'm generating the HTML using Tapestry5.


Solution

  • It turns out I had an autofocus to a search box.