Markdown preview does not scroll to top on new URI
See original GitHub issueDoes this issue occur when all extensions are disabled?: N/A (depends on the built-in markdown extension)
- VS Code Version: 1.72.1
- OS Version: macOS 12.4
Steps to Reproduce:
- Create two Markdown documents, one with a relative link to the other, and enough content in both documents to scroll down
- Preview the document with the link and scroll down to the link, then click it
Expected Behavior:
The link to the other document should open the new document at the top
Actual Behavior:
The scroll position stays the same, opening the new document at a random spot in that document
Other Information:
This change is probably straightforward to make, but it would break the existing behavior. I’m struggling to imagine why that behavior would be desirable though, so not sure it would actually affect anyone in a meaningful way.
cc @mjbvz
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
VSCODE -- has anyone figured out how to stop markdown ...
What I've found is that the preview does not track the location that is in view in the editor, so I have to...
Read more >January 2021 (version 1.53) - Visual Studio Code
Markdown preview auto updates when images are changed on disk. The Markdown preview will now automatically update when any embedded images are changed...
Read more >Preview - Dendron
The Dendron Preview gives you a rich HTML preview for your notes. Details. when a note is open by clicking a link in...
Read more >Markdown - vscode-docs1 - Read the Docs
Additionally, double clicking an element in the Markdown preview will automatically open the editor for the file and scroll to the line nearest...
Read more >Untitled
Image caps # Similar to headers and footers, cards can include top and bottom ... Scroll 80 React Markdown Editor Lite Attaching non-image...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, I’m new to Open Source development and I was going through the Good First Issue label and figured I could take a crack at this one.
I think I have traced the problem back to this section of code, but I’m not sure how to proceed.
This is in the file “extensions\markdown-language-features\preview-src\index.ts”
It seems the scrollProgress of a preview window is stored in a state variable and when the link is clicked, the scrollProgress is restored using that piece of code. I’m not sure if that is intended behavior, or a bug fix for another issue.
Commenting out line 65 actually solves the issue, but again, I am not sure if the line was added for some other bug fix or intended behavior, since the commit message for that line does not specify a bug fix.
cc: @dsanders11
@dsanders11 I tried digging into the issue and found that because it is an in-place reload of the Preview, the scroll bar tries to get back to its original position after rerendering. Do you recommend opening a new tab for the linked document’s preview, that would ideally solve the issue.
P.S. I tried setting the
StartScrollLine
number of the linked document to0
before rerendering but it didn’t seem to work.cc. @mjbvz