Skip to content

Mermaid diagram shift page when opening a link with anchor  #9940

Closed as not planned
@AKiedis

Description

@AKiedis

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

When opening the provided link in the step to reproduce, which points to a page containing a Mermaid diagram, the page shifts or scrolls due to the presence of the graphic, causing it not to land precisely at the anchor specified in the URL.
Every page with a mermaid diagram in my personal project suffer from the same issue.

Reproducible demo

No response

Steps to reproduce

  1. Open the following URL: https://docusaurus.io/fr/docs/next/markdown-features/diagrams#configuration
  2. Observe the page behavior as it loads.

Expected behavior

The page should load and position itself precisely at the anchor specified in the URL, allowing users to land directly at the intended section.

image

Actual behavior

Upon opening the URL, the page shifts or scrolls due to the presence of the Mermaid diagram, causing it to miss the anchor and land at an incorrect position.

image

The length of the shift depends on the length of the graphic.

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome and Firefox
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 11

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its executionclosed: duplicateThis issue or pull request already exists in another issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions