Skip to content
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

Markdown preview does not scroll to top on new URI #164071

Open
dsanders11 opened this issue Oct 19, 2022 · 13 comments · Fixed by #164999, #176437 or #178153
Open

Markdown preview does not scroll to top on new URI #164071

dsanders11 opened this issue Oct 19, 2022 · 13 comments · Fixed by #164999, #176437 or #178153
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders markdown Markdown support issues
Milestone

Comments

@dsanders11
Copy link
Member

Does 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:

  1. Create two Markdown documents, one with a relative link to the other, and enough content in both documents to scroll down
  2. 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

@vscodenpa
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.72.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities good first issue Issues identified as good for first-time contributors labels Oct 19, 2022
@mjbvz mjbvz added this to the Backlog milestone Oct 19, 2022
@mjbvz mjbvz added the markdown Markdown support issues label Oct 19, 2022
@K0more
Copy link

K0more commented Oct 20, 2022

Hey can I get this assigned

@dsanders11
Copy link
Member Author

@K0more, no need to have the issue assigned to you. You're welcome to make a PR to fix it if you want. 🙂

@LoopThrough-i-j
Copy link
Contributor

LoopThrough-i-j commented Oct 23, 2022

@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 to 0 before rerendering but it didn't seem to work.

cc. @mjbvz

@GauravB159
Copy link
Contributor

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.

image

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

@Djunnni
Copy link

Djunnni commented Oct 29, 2022

@dsanders11
hi, i have a question about Testing "/src/vs/workbench/contrib/webview/browser/pre/index.html"

i want to fix some of code there. but when i fixed then run complie-web, it's not changed!

how can test this point ?

i run

1. yarn
2. code change ...
3. npm run compile-web
4. npm run gulp
5. ./script/code-web.sh

LoopThrough-i-j added a commit to LoopThrough-i-j/vscode that referenced this issue Oct 30, 2022
LoopThrough-i-j added a commit to LoopThrough-i-j/vscode that referenced this issue Oct 30, 2022
LoopThrough-i-j added a commit to LoopThrough-i-j/vscode that referenced this issue Oct 30, 2022
@mjbvz mjbvz modified the milestones: Backlog, November 2022 Nov 9, 2022
mjbvz pushed a commit that referenced this issue Nov 9, 2022
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Nov 9, 2022
@amunger amunger added the verified Verification succeeded label Nov 30, 2022
@mjbvz mjbvz modified the milestones: November 2022, December 2022 Dec 6, 2022
@mjbvz mjbvz removed the verified Verification succeeded label Dec 6, 2022
@mjbvz
Copy link
Collaborator

mjbvz commented Dec 6, 2022

Reopening since the PR that fixed this had to be reverted: #168224

@mjbvz mjbvz reopened this Dec 6, 2022
@vscodenpa vscodenpa removed the insiders-released Patch has been released in VS Code Insiders label Dec 6, 2022
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Mar 23, 2023
@rzhao271 rzhao271 added the verified Verification succeeded label Mar 23, 2023
@rzhao271
Copy link
Contributor

The preview did not scroll to the top:
Screencap, showing that when opening the second file, the preview is still stuck at the bottom

@rzhao271 rzhao271 reopened this Mar 23, 2023
@vscodenpa vscodenpa removed the insiders-released Patch has been released in VS Code Insiders label Mar 23, 2023
@rzhao271 rzhao271 added verification-found Issue verification failed insiders-released Patch has been released in VS Code Insiders and removed verified Verification succeeded labels Mar 23, 2023
@mjbvz
Copy link
Collaborator

mjbvz commented Mar 23, 2023

@rzhao271 Which commit did you test on? This fix just went in and is only in deedbd3

@rzhao271
Copy link
Contributor

I am on deedbd33f5dc57795e11da7c2a26b5a05a93485b

@mjbvz mjbvz modified the milestones: March 2023, April 2023 Mar 24, 2023
@mjbvz mjbvz removed the verification-found Issue verification failed label Mar 24, 2023
@mjbvz mjbvz modified the milestones: April 2023, May 2023 Apr 24, 2023
@N-NeelPatel
Copy link

@mjbvz - is this fixed now?

@mjbvz mjbvz modified the milestones: May 2023, June 2023 May 31, 2023
@mjbvz mjbvz modified the milestones: June 2023, July 2023 Jun 22, 2023
@mjbvz mjbvz modified the milestones: July 2023, August 2023 Jul 24, 2023
@mjbvz mjbvz modified the milestones: August 2023, September 2023 Aug 29, 2023
@mjbvz mjbvz modified the milestones: September 2023, October 2023 Sep 26, 2023
@mjbvz mjbvz modified the milestones: October 2023, On Deck Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders markdown Markdown support issues
Projects
None yet