Hash links do not work correctly when using the `StateHistory` manager
- Dominant language
- TypeScript
- Stars
- 623
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
**Enhancement**
When a hash is applied the expected behaviour is the browser to scroll to an associated node with a matching `id` attribute. There are a couple of issues dealing using anchor tags in combination with using the `StateHistory` manager.
1) When working with lazily loaded content (for example when an application is leveraging code splitting), the router or native `a` node with a `href` updates the hash before the content with the matching `id` has been rendered. This means that the browser will not navigate to the correct section of content.
2) The `Link` components have no way to accept an additional hash. A native `a` node can be used but the user would need to generate the correct route prefix using the `router.link` command. Although this would take some boilerplate that should not be necessary.
It could perhaps be possible for the framework manage the hash navigation in some way once lazily loaded content is rendered. This would need some investigation to see how it could be handled/implemented.
For the `Link` part of issue, perhaps creating a new `Link` component that provides all the link details but leaves the what to render up to the consumer - this would allow them to add a hash to the router generated url.
Contributor guide
Assessment
This issue has not been assessed yet.