Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash links do not work correctly when using the StateHistory manager #281

Open
agubler opened this issue Mar 1, 2019 · 1 comment
Open
Labels
area: routing Routing enhancement New feature or request

Comments

@agubler
Copy link
Member

agubler commented Mar 1, 2019

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.

@agubler agubler added the enhancement New feature or request label Mar 1, 2019
@matt-gadd
Copy link
Contributor

matt-gadd commented Mar 1, 2019

@agubler it would be nice to support this with the hash adapter too if possible (even though it would look weird) #foo/bar/baz#element-to-scroll-to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: routing Routing enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants