Skip to content

On-page anchor scroll can result in incorrect URL shift with certain headings #134

@mattstein

Description

@mattstein

Description

From @engram-design in Discord:

Not sure if this has been reported yet, but I'm noticing that after clicking on a heading in the docs, it scrolls to that heading, the url fragment changed, but 5 seconds later changes back? For example, heading to https://craftcms.com/docs/commerce/3.x/orders-carts.html#carts - scroll down the page and click on any heading. The URL will change to reflect the new heading, but will flick back to the original URL. Clicking on the heading "#" again will update the URL correctly.

Notably, this looks like an issue with H3 links, the H2 ones are fine

Heading levels beyond the sidebar navigation result in weird behavior because of a workaround for another VuePress scroll bug. All heading levels should be registered and handled consistently.

Steps to reproduce

  1. Visit page like Orders & Carts whose content uses heading levels deeper than right sidebar links.
  2. Choose any link next to an h3+ heading.
  3. Observe correct URL in address bar, but moments later it reverts to nearest higher-level anchor.

Metadata

Metadata

Assignees

Labels

BugNon-content problems with the navigation or display of the documentation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions