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

<Link /> doesn't handle hashes well #2098

Closed
grabbou opened this issue May 29, 2017 · 2 comments
Closed

<Link /> doesn't handle hashes well #2098

grabbou opened this issue May 29, 2017 · 2 comments
Assignees

Comments

@grabbou
Copy link

grabbou commented May 29, 2017

When you have a <Link /> component that points to an arbitrary section of a different page, e.g. <Link href="/#who-we-are" /> (in this case, I want to go to who-we-are section of /), it will only work when that link is pressed from another page.

When this link is pressed on the / page, Next will not scroll into that view. I believe it's because we don't have any code in Container.js to handle hash change. We only seem to handle didMount scenario.

Also, since we are using history.pushState, there's no hashchange event being fired. That means we need to integrate handling logic somehow into the router itself.

@sergiodxa
Copy link
Contributor

Link it's only to do client side navigation, if you don't go to another page use a native anchor tag

@arunoda
Copy link
Contributor

arunoda commented May 31, 2017

@grabbou this is a good. I need to check this a bit.
@sergiodxa You've a valid point. But this should work.

@arunoda arunoda self-assigned this May 31, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants