Skip to content

[Bug] Markdown-rendered headings have no id — Outline links never scroll to their target #4173

Closed

Description

@Aitopeople

Description

Outline's own docs state the id on an outline item "should match the target heading element id," and useOutlineFromMarkdown is provided specifically to derive that id list from markdown text. But Markdown never writes an id onto the h1–h6 elements it renders, and there's no supported way to inject one — MarkdownProps has no id/slug option, and the components.heading override only receives {level, children}, not a slug or index. As a result, clicking an Outline item built from useOutlineFromMarkdown output changes location.hash but never scrolls, because document.getElementById(id) returns null (Outline's click handler silently no-ops when that happens, so it falls back to whatever the browser's default anchor behavior is).

Expected: Markdown + useOutlineFromMarkdown + Outline used together navigate to the correct heading, matching what the docs imply.
Actual: navigation silently does nothing (hash changes, scroll position doesn't).

At minimum, this is a documentation/API-contract issue: the documented Markdown-derived outline IDs cannot be attached to headings through any supported Markdown API.

Reproduction

import {
  Markdown,
  Outline,
  useOutlineFromMarkdown,
} from '@astryxdesign/core';

const markdown = `
# Overview

content

# Installation

content
`;

export default function Page() {
  const items = useOutlineFromMarkdown(markdown);

  return (
    <>
      <Markdown>{markdown}</Markdown>
      <Outline items={items} />
    </>
  );
}
  1. Render the above.
  2. Click the "Installation" item in Outline.
  3. Expected: page scrolls to the "Installation" heading.
  4. Actual: location.hash becomes #installation, but window.scrollY stays unchanged — no element in the DOM has id="installation" (confirmed via document.getElementById('installation') === null).

This reproduces with the official Outline doc example verbatim plus a bare render — no app-specific code involved.

Astryx Version

@astryxdesign/[email protected]

Environment

Next.js 16.2.10, React 19.2.4, Chrome (Windows 10)

Activity

  1. added
    bug
    on Jul 22, 2026
  2. cixzhang commented on Jul 28, 2026

    @cixzhang
    Contributor

    Tracked in the accessibility program tracker: #4475

  3. cixzhang commented on Jul 28, 2026

    @cixzhang
    Contributor

    Tracked in the accessibility program tracker: #4475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions