When using anchors in a page they never take the user to anchor in question because the standard behaviour is to scroll to the anchor at the top of the viewport which is covered by Confluence's UI. This makes anchors less useful for navigating confluence pages.
How to recreate:
Suggestion(s)
If the native behaviour does not work (which it doesn't seem to) then confluence needs to augment that behaviour to scroll to a point where the selected anchor is visible and accounts for the offset of the confluence UI.