Skip to content

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

Closed
@grabbou

Description

@grabbou

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions