Skip to content

Stabilize the Table of Contents Block #42229

Description

@priethor

What problem does this address?

The table of content blocks was first released in Gutenberg 13.3 as an experimental block. A few releases later, no major bugs have been reported and we should start considering taking the block out of experimental.

What is your proposed solution?

Taking the block out of experimental would bring the block closer to shipping in WordPress 6.1.

Apart from removing the experimental flag in block.json it would be good to stabilize the dependent selector __experimentalGetGlobalBlocksByName, first introduced in #39610.

  • @getdave do you see any reason not to stabilize the mentioned selector?
  • @ZebulanStanphill @gziolo do you see any blocker not to stabilize the ToC block or other steps that should be done?

Pending items

User Stories

The following user stories reflect the desired behaviour from a user standpoint.

Writing and editing (content authors)

  • As a content author, I should see the table of contents automatically update as I add, remove, or reorder headings, in order that I never have to build or maintain navigation by hand.
  • As a content author, I should see an accurate preview of the table of contents while I'm still editing, in order that I can trust what I see before I publish.
  • As a content author, I should be able to limit which heading levels appear - for example, only main sections, not sub-points - in order that the table of contents stays focused and useful on longer pages.
  • As a content author, I should be able to choose between a numbered and a bulleted style, in order that the table of contents matches the look of the rest of my content.
  • As a content author, I should see a clear message when my page has no headings yet, in order that I understand why the block looks empty rather than assuming it's broken.

Reading and navigating (site visitors)

  • As a reader, I should be able to click any item in a table of contents and land exactly on that section, in order that I can move through long content quickly.
  • As a reader, I should never click a table of contents link and end up on a missing or broken page, in order that I trust the site's navigation.
  • As a reader, I should be taken to the right page of a multi-page article, even if the section I clicked is on a different page than the one I'm currently reading, in order that pagination doesn't break navigation.
  • As a reader, I should see the table of contents laid out to match the structure of the page, with sub-sections nested under their section, in order that I can judge how the content is organised before I start reading.

Accessibility (readers using assistive technology)

  • As a reader using a screen reader, I should be able to recognise the table of contents as a distinct, named region of the page, in order that I can jump straight to it or skip past it, rather than listening through it by accident.
  • As a reader navigating by keyboard, I should be able to reach and move through the table of contents links in a predictable order, in order that I'm not stuck or disoriented.
  • As a reader using a screen reader, I should be able to tell the table of contents apart from the site's main menu, in order that I don't confuse the two when there's more than one navigation region on the page.

Placing the block across a site (site builders)

  • As a site builder, I should be able to add a table of contents once to a shared template, in order that it automatically appears on every post using that template, without adding it to each post individually.
  • As a site builder, I should see a clear explanation in the editor when the table of contents can't show a live example while I'm editing a template directly, in order that I understand what it will actually do for visitors rather than assuming it's broken.
  • As a site builder, I should be confident that a table of contents only ever lists headings from the specific post or page being viewed, never headings from the template itself or from any header, footer, or other reusable template part it includes, in order that every entry reliably takes a reader to part of the actual post.
  • As a site builder, when I place the table of contents on a template that doesn't show one specific post - such as an archive, a search results page, or a "page not found" page - I should see an explanatory placeholder while editing, and it should quietly produce nothing on the actual page, in order that it never tries to show something meaningless to a reader.

Supporting content built with other blocks (authors and developers)

  • As a content author, I should have my headings count towards the table of contents no matter which block I used to create them, in order that I'm not forced to change how I write just to get working navigation.
  • As a theme or plugin developer, I should be able to register my own block as a heading source, in order that content built with my block isn't silently left out of visitors' tables of contents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs Technical FeedbackNeeds testing from a developer perspective.[Block] Table of contents (experimental)Affects the Table of contents Block[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Status] In discussionUsed to indicate that an issue is in the process of being discussed[Type] TaskIssues or PRs that have been broken down into an individual action to take

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    🦵 Punted to 7.2

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions