-
Notifications
You must be signed in to change notification settings - Fork 30k
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 auto-scrolls unnecessarily when space exists to display the entire preview #43694
Comments
Thanks for the report. Yes the current 'click to jump back to editor' functionality is specifically designed to position the clicked element near the top of the screen. This position is always the same because it makes it easy to find which editor line corresponds to the element you just clicked on. I prototype doing minimal scrolling instead but found this to be a very confusing experience I'm actually in favor of removing the double click functionality entirely once #19459 is supported. The double click stuff was sort of a workaround for that issue. Hopefully some new APIs will make it possible this iteration or next |
@mattbierner I wasn't reporting about this, and I don't even use that feature. Might be worth re-reading what I wrote. Everything I described above related to the behaviour that occurs when focused on the editor, and how it triggers unnecessary and unintuitive scrolling in the preview. TL;DR: I want to see as much of the preview as possible when I make changes, and the fact that when I click/focus text at the bottom of my markdown code it scrolls the preview all the way up to the top, obscuring most of the preview when there is ample space to display it all, is really annoying and renders the preview somewhat unusable for ongoing editing of short documents - all I want is to see a preview of my document as I edit it. If the preview only shows me the last tiny bit of the document, I may as well not have a preview. |
Sorry I thought you were talking about clicking in the preview in your repo steps. However it's the exact same argument and I believe that #19459 is still a better experience to aim for Right now, we scroll the markdown preview based on your editor selection. This is a hack because we don't have an API for getting the editor's viewport. #19459 tracks full scroll sync between the editor viewport and the preview viewport, which would eliminate the unnecessary scrolling you reported . The api for implementing this is even on our February iteration plan (see |
When navigating to different points in my markdown document, I'm seeing that the preview will scroll down to the focused block even though the entire preview can fit in the viewport with plenty of space to spare. It seems like it's trying to anchor the focused point to a position that is roughly at a 20% distance from the top of the preview viewport, and in doing so, not considering whether the available space makes this unnecessary.
I do like the way the automatic scrolling makes sure the focused block is roughly at a 20% distance from the edge of the viewport so that you have the context of the text above and below it, but this should not happen if all of the preview content will fit in the viewport.
It should also happen relative to the direction being scrolled, not just relative to the top of the viewport. i.e. If scrolling down, bring the bottom of the selected block to a 20% distance from the bottom of the viewport, while being careful to clamp the scroll position for very large blocks so that the top of the block is not pushed further up than the current 20% distance from the top of the viewport.
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes
My suggestions:
The text was updated successfully, but these errors were encountered: