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
Docusaurus URL with # does not always navigate to the correct anchor with external images in it #9520
Comments
Thanks
I can't reproduce any issue on those links. Can you record a video and specify which browser you are using? Can you provide a minimal open source repro using docusaurus.new?
That's a different bug, Mermaid diagrams are not rendered at build time but only on the client-side. This produces annoying layout shifts. This bug is tracked in #8299
Please report the different cases independently and provide a link/repro so that we can investigate each case in isolation. For each case please share at least a link, md source, screenshot or video Note if you scroll then reload, the std browser behavior is not to scroll back to the url anchor but rather to restore the former scroll position. |
@slorber Thank you for your reply. In that case, case 2 is already invalid. I didn't provide a reproducible demo because our documentation is open to the public and the code is open source. But I understand, for the sake of simplicity I'm going to create a new one and try the case there |
@slorber Sorry for the late reply.
And since it is loaded right away, assumably due to image content it doesn't scroll properly to the anchor. I'll also try it on Also, should I edit the title&description to match the issue, because the correct issue is a bit more specific than I've provided. |
@slorber I've edited the issue with reproducible docusaurus.new demo, please take a look |
Hi! This is working as intended. We match the default browser behavior of eagerly scrolling, and it will be very tricky to wait for images loading, because our default optimizations make images not load at all unless they scroll into view! If you want to avoid layout shifts caused by image loading, remember to add explicit |
I see, then it's better to determine width/height standard and style it with fixed dimensions will solve the problem at hand. Thank you! |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Hello! My name is Furkan from Appcircle CI/CD. Thanks for creating such a convenient tool that powers our documentation. We also open sourced our own documentation as well.
I've come across some slightly minor problem when there's an image on a documentation link, anchoring and referencing them is slightly off sometimes, especially when there are too many close anchors to each other, it gets noticeable pretty fast.
It happens on our documentation, https://docs.appcircle.io but I've also checked the https://docusaurus.io itself to check it happens and I noticed that it happens on a few pages with images on it. Docusaurus.io doesn't have that many images so it's harder to catch the issue there. I've added that in reproducible demo stage on a page I've found which has an image in it.
The context is, when there are lots of images and anchor link is on bottom of the images, it renders afterwards.
I've also checked the function that is responsible for scrolling with anchor, but I've found nothing wrong with it on sight.
Thank you for your consideration! Sorry that I won't be able to fix the issue myself.
Reproducible demo
StackBlitz Demo:
https://stackblitz.com/~/github.com/furkanarabaci/docusaurus-anchor-issue
From Official Appcircle Documentation:
auto device register link
Observe the scroll behavior
Steps to reproduce
/docs/start#anchor
(make sure it's uncached)Case 2: - ReloadDeemed as invalid ✅1. Go to a link with anchor in it2. Scroll a bit down or up, doesn't matter3. Reload or force reload the page,4. Notice the scroll state sometimes aligns with anchor, but most of the time it doesn'tExpected behavior
The page to be scrolled properly to its anchor
Actual behavior
Notice that the anchor is not properly aligned on both cases. Case 1 is a guess game, most of the time it works but there are cases which it doesn't work
Your environment
Self-service
The text was updated successfully, but these errors were encountered: