You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a folder and make a page for example /someDir/page.tsx
Add Link component into it, specify href props as #foo
Describe the Bug
If I click <Link> component pointing #foo in the page /someDir, then it navigate to /#foo instead of /someDir#foo. It seems that <Link> component does not resolve path properly.
Pages Router (devtools)
App Router (devtools)
Expected Behavior
I expect that on /someDir page, href #foo should be resolve to /someDir#foo as same as in Pages router.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered:
cdtkrk
changed the title
Link component does not resolve a relative URL properly
Link component does not resolve a relative URL fragment properly
Jun 6, 2023
You have to explicitly define your route paths, also "/someDir#foo" This path seems illogical if you are not using it to navigate to a particular section on the page itself
cdtkrk
changed the title
Link component does not resolve a relative URL fragment properly
Link component does not resolve a relative URI fragment properly
Jun 6, 2023
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.3.0: Thu Jan 5 20:49:43 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T8103 Binaries: Node: 18.15.0 npm: 9.5.0 Yarn: N/A pnpm: N/A Relevant packages: next: 13.4.4 eslint-config-next: 13.4.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/vigilant-https-f3r6c3
To Reproduce
/someDir/page.tsx
href
props as#foo
Describe the Bug
If I click
<Link>
component pointing#foo
in the page/someDir
, then it navigate to/#foo
instead of/someDir#foo
. It seems that<Link>
component does not resolve path properly.Pages Router (devtools)
App Router (devtools)
Expected Behavior
I expect that on
/someDir
page, href#foo
should be resolve to/someDir#foo
as same as in Pages router.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: