quartz
quartz copied to clipboard
Collapsed Callouts Lead to Incorrect Table of Contents Scrolling
Describe the bug When sufficiently long notes have collapsed callouts, the anchors are incorrectly placed, causing scrolling using the table of contents to scroll past the target headings.
Follow up to Issue#574 - while scrolling is correct when I enter the URL (with anchor) into the browser, scrolling via the note's table of contents still appears to scroll past the target heading (because of the collapsed callouts).
To Reproduce Steps to reproduce the behavior:
- Ensure that notes have the table of contents feature enabled.
- Create a note with headings and sufficient content such that the anchors will cause you to scroll throughout the note.
- Add a collapsed callout (-) with sufficient content before a heading.
- Click on the target heading in the note's table of contents to jump to it.
Note that with the collapsed callout, the anchor will jump as if the callout was not collapsed, scrolling to the incorrect place. While copy and pasting the corresponding anchor into the browser URL works, using the table of contents to scroll does not appear to work.
What's interesting is that clicking the target heading in the table of contents more than once can sometimes cause the scrolling to be work as intended, but not always.
Expected behavior When using an anchor, we should jump to the heading, not past it. This isn't too big of a deal with one or two collapsed callouts, but as more are added to a note, the issue gets more and more noticeable.
Screenshots You can see the behavior in one of the pages of my vault here - try using the table of contents to click on one of the later headings in the note, and observe how the scrolling goes far beyond the target location.
Desktop (please complete the following information):
- Device: MacBook Pro
- OS: Monterey 12.4
- Browser: Microsoft Edge
@shuyelin06 Could you provide the raw .md file used here? I've been trying to reproduce your bug with various callouts and heading styles but it doesn't seem to be working for me.
@slimeborger Of course - here it is Moment Generating Functions.md
Okay, this is really weird. I have the .md file built and quartz correctly navigates to the anchored headings using ToCs. Perhaps it was an old bug and is now patched?
@slimeborger what browser are you on? I can repro on Chrome
Running on Firefox 119.0.1 When i went to shuyelin's site, it was bugged, but on mine it wasn't. which is weird