Open thesamovar opened 1 year ago
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Thanks @thesamovar for the feedback. I was writing a blog a few months ago and had to stop and implement the first-version of scroll restoration because I couldn't concentrate on the writing with all the jumping -- totally understand the frustration, and thought I had got it working well enough.
The current version saves your scroll height to local storage before triggering a reload, and then scrolls back there ~30ms after load.
Current implementation is here.
Can you let me know if there are images above your scroll position? Or something else above your viewport that would change size? That would help track this down I think.
There's all sorts! Images, equations and some mermaid diagrams.
I just checked and can confirm it's the mermaid diagrams that cause the problem. If I remove them the scroll works fine!
Ok, thanks for doing that debugging, I think we might need to save the heights/aspect-ratio of the diagrams after they are rendered (probably in a separate headless browser, which also allows screenshots to be taken for other export tasks).
Doing that properly is a fair bit of work, but we could probably fake it and get some thing that improves the experience for now.
Can you give me a sense of the variation of heights
the mermaid diagrams you are using? For example by running something like this in your web console?
[...document.querySelectorAll('figure > div > svg')].map((e) => e.clientHeight)
Hm, I suppose that we could actually do that calculation on the fly and remember it in your browser and then it would be exact as long as you aren't editing those diagrams.
What version of
mystjs
are you using?0.1.11
How did you install myst?
npm
What operating system are you using?
Windows
Which area is this feature request for?
Command Line Interface
Describe the Bug
When running myst locally and viewing on localhost, when I update a markdown file, the page rebuilds automatically (great) but for some reason it scrolls down a little way meaning I keep having to switch to the browser and scroll back up. It's a minor bug but surprisingly irritating! 😂
Expected Behavior
Current view should stay where it was.
To Reproduce
View a page when editing with multiple sections, figures and equations (not sure if relevant).