Repository navigation
Closed
Labels
bugAn error in the Docusaurus core causing instability or issues with its execution
Description
🐛 Bug Report
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clearoryarn clearcommand. - I have tried
rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages. - I have tried creating a repro with https://new.docusaurus.io
- I have read the console error message carefully (if applicable)
Description
Anchor links that target headers in other pages are failing. Instead of sending users to the target header, users are sent to the top of the page.
Have you read the Contributing Guidelines on issues?
Yes
Steps to reproduce
- Go to this link: https://docusaurus.io/docs/using-themes#writing-customized-docusaurus-themes
- Click on
getThemePath()
Expected behavior
Expected to go to the target header
Actual behavior
Get sent to the top of the page

Your environment
- Docusaurus version used: 2.0.0-beta.1
- Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Firefox 89, Chrome 91
Reproducible Demo
Demo 1
- Go to https://deploy-preview-4797--docusaurus-2.netlify.app/docs/using-themes#writing-customized-docusaurus-themes
- Click on the
getThemePath()link
Demo 2
- Go to https://deploy-preview-4811--docusaurus-2.netlify.app/docs/deployment#self-hosting
- Click on the
docusaurus servelink
Root Causes
There are 2 root causes here - they correspond to the 2 demos above.
Root cause for Demo 1
PR #4797 is the earliest PR that has the bug, so I believe it is the root cause of the regression. Adding back the !hash condition (as shown below) resolves this bug, but I'm not sure if this is the right approach.
Root cause for Demo 2
Demo 2 is the state before PR #4797 was merged. Certain anchor links still fail. This is due to incorrect anchor link specified on the user side. I will open a PR to resolve this.
Metadata
Metadata
Assignees
Labels
bugAn error in the Docusaurus core causing instability or issues with its execution


Activity
lex111 commentedon Jun 20, 2021
@teikjun thanks for the report, yes, you're right, we should ignore hash changes in that hook, my bad, will be fixed in #5023.