-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(v2): classic theme - semantic correct anchors links #5080
Conversation
✔️ [V2] 🔨 Explore the source changes: ddd18fe 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/60dc306ec43c1c00076605d6 😎 Browse the preview: https://deploy-preview-5080--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5080--docusaurus-2.netlify.app/ |
I don't have much experience with those external tools but it could be nice for Docusaurus to provide some recommendations about that (ideally we should also detect broken anchor links, another feature request). Can you share your experience? @lex111 any opinion about removing |
Apparently this leads to Lint errors: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md
|
Well, I am just exploring this space myself. We have generated API reference from Typedoc where we have lot of links for our upstream documentation (external links). I can foresee moments where the upstream docs will change and I expect 99% chance that we won't detect that, so I am trying to come up with some automatic detection for that. I found https://github.com/timaschew/link-checker that looks like a good tool for that task.
What I found during my research was this PR (related to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, we can safely remove hashbang from sidebar links, because it is deprecated technique. I can not say exactly why was initially added.
And also I'm not against suppressing ESLint errors for skip link too.
thanks for the feedback 👍 |
Motivation
Across the Classic Theme, there are two places where a link points to an anchor that does not exist on the page. This is for example problem for tools that try to verify the validity of links and if applicable their anchors. These tools are crucial in maintaining coherent documentations.
This PR fixes these links to be semantic correct and uses simple
#
instead.Alternative to this change is to introduce
#main
anchor for the "Skip to main content" on themain-wrapper
element. But not sure what would then be introduced for the Doc Sidebar.Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Related PRs
None