Skip to content

Link click on TOC breaks highlighting when scrolling #376

@hirusepalika

Description

@hirusepalika

Hello!

We are running into an issue with table of contents after updating to 4.33.0.

Current behavior

  1. Click on a link in the table of contents.
  2. Scroll past it up or down, the highlight is fixed on the one link I clicked.

Expected behavior

  1. Click on a link in the table of contents.
  2. Scroll past it up or down, the highlight should change based on what anchor is in view.

I narrowed the issue down to the following

I am using yarn -> yarn add tocbot@https://github.com/tscanlin/tocbot#b5b25013dfcce37621e6f930660f1b9e70df5c42

Using Javascript to initialize tocbot,

tocbot.init({
    tocSelector: ".js-toc",
    positionFixedSelector: ".js-toc",
    contentSelector: ".docs-content",
    headingSelector: "h2, h3, h4",
    collapseDepth: 6, // Uncollapse all headers.
    // These should match our header-offset CSS variable.
    // header-offset = 4rem = 64px
    headingsOffset: 64,
    scrollSmoothOffset: -64,
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions