Skip to content

Popover fails to scroll to new heading when hovering consecutive links to same page #2081

@TroyeJames9

Description

@TroyeJames9

Describe the bug
When hovering over multiple links pointing to different headings within the same page, the preview popover retains its previous scroll position rather than scrolling to the new target heading. Specifically, after previewing one heading on a page, hovering over another link to a different heading on that same page will still show the previously viewed section in the popover.

To Reproduce
Steps to reproduce the behavior:

  1. Create a page "Cited page" with two headings: # Section A and # Section B
  2. Add two links on another page “citing page" [Link A](cited%20page.md#Section%20A) and [Link B](cited%20page.md#Section%20B)
  3. First hover over "Link A" - popup correctly shows Section A at top
  4. move cursor to "Link B"
  5. Popover remains showing Section A instead of scrolling to Section B

Expected behavior
Popover should always scroll to display the heading corresponding to the currently hovered link. When previewing a new heading on the same page, the popover should automatically scroll to make that heading visible.

Screenshots and Source

The following screenshots were taken on the same webpage

Image
Image

I can provide a PR to fix this issue. The bug exists in the popover preview functionality script (quartz/components/scripts/popover.inline.ts) due to stale DOM references.

Desktop (please complete the following information):

  • Quartz Version: v4.5.1
  • node Version: v22.17.0
  • npm version: 10.9.2
  • OS: Win10 Home
  • Browser: Chrome 139.0.7258.67

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions