Update: This is not an issue (see comment at Base href messing up internal anchor links)
The standard behaviour for Plone is to generate a base tag for each page.
This can be overriden in the theming-control panel advanced settings > absolute path prefix.
This is often useful to ensure that resources like images and stylesheets are loaded properly but there is one negative repercussion. Internal links to ids and anchor tags are also affected by the base tag. The most problematic scenario is when viewing a folder's default view (this is because the base href is set to the URL of the default view not the folder itself) the classic scenario is that a link on a page served from example.com
that looks like this::
<a href="#top">go to top</a>
assuming it is associated with a page named 'front-page', is treated as if it were:
<a href="https://example.com/front-page#top">go to top</a>
Instead of simply linking to the top of the page, this forces a page refresh as it attempts to go directly to /front-page#top
.
It seems the best way to fix this is use JS to detect the current location and then append the internal anchor link. Still investigating. I could remove the base href info but I think that might have some undesirable repercussions.
Possilble fix
In the future it might be useful to force the algorithm that determines the base href to always look at the folder URL rather than appending the defined default view URL. This, of course, does not address situations when the base href is set in the theming controlpanel.