Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table of Contents block does not include links when inserted on a template #88592

Closed
jp-imagines opened this issue Mar 17, 2024 · 4 comments
Closed
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Feature] Core Blocks Blocks that come with Gutenberg. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Platform] Simple [Pri] Normal [Product] WordPress.com All features accessible on and related to WordPress.com. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. [Status] Priority Review Triggered Quality squad has been notified of this issue in #dotcom-triage-alerts Triaged To be used when issues have been triaged. [Type] Bug

Comments

@jp-imagines
Copy link

Quick summary

The Table of Contents block should automatically create an ordered list of links to headers on the current content. When inserted on a template in the site editor, the headings are shown in a list of plain text instead.

Steps to reproduce

  1. Start on a site with a block theme active.
  2. Open the site editor (Appearance > Editor) and create a new template or edit an existing template.
  3. Add a Table of Contents block to the template.
  4. Add one or more Heading blocks to the template (after the Table of Contents). See that the headings appear in the Table of Contents list, but are not linked.
  5. View a post or page which uses the chosen template to see the Table of Contents appears on the live site without links as well.
  6. For comparison, add a Table of Contents block to a single post or page (repeating steps 3-4).

What you expected to happen

Table of Contents block's list items should automatically include links to the corresponding headings.

What actually happened

On templates, the list is plain text (<span>) instead of links (<a>).

Impact

Some (< 50%)

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

Simple

Logs or notes

Unclear if this is an intentional decision, considering Table of Contents are probably intended to be used for individual pieces of content instead of templates. However, for some templates (e.g. Front Page, Blog Home, or custom templates created for a specific post or page), it can make sense to include a linked Table of Contents as the template is more like a post/page than a multi-use template in those cases.

Initial report: 7830208-zd-a8c

@jp-imagines jp-imagines added [Type] Bug Needs triage Ticket needs to be triaged [Product] WordPress.com All features accessible on and related to WordPress.com. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Feature] Core Blocks Blocks that come with Gutenberg. labels Mar 17, 2024
@github-actions github-actions bot added [Status] Priority Review Triggered Quality squad has been notified of this issue in #dotcom-triage-alerts [Platform] Simple [Pri] High labels Mar 17, 2024
Copy link

Support References

This comment is automatically generated. Please do not edit it.

@github-actions github-actions bot added the Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". label Mar 17, 2024
@liviopv
Copy link

liviopv commented Mar 20, 2024

📌 REPRODUCTION RESULTS

  • Replicable outside of Dotcom – Yes

📌 FINDINGS/SCREENSHOTS/VIDEO
Reproduced, it doesn't seem like TOC is designed to work inside templates at the moment:

CleanShot 2024-03-20 at 15 44 41@2x

📌 ACTIONS

  • Triaged

Issues in core:

📌 Message to Author
@jp-imagines we might see some developments in the TOC block in the next release cycle, but it is currently not designed to be used within templates, only in Post/Page Content. Please inform the user that they will need to manually add to each post/page for now.

@liviopv liviopv added [Pri] Normal [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. Triaged To be used when issues have been triaged. and removed Needs triage Ticket needs to be triaged [Pri] High labels Mar 20, 2024
@molszewska
Copy link

I'd like to add to that, that whenever a change is made to a page, it breaks the already existing Table of Contents and removes links from it. Removing the block and re-adding it is a temporary workaround.

@mrfoxtalbot
Copy link

I can no longer reproduce this. If I add the TOC block to a template, it shows headings from outside the content (in this case, from the footer):

Image

Image

I think we can close this specific issue as "no longer relevant" but I checked the three related core issues and they are still open and relevant:

@mrfoxtalbot mrfoxtalbot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Feature] Core Blocks Blocks that come with Gutenberg. [Feature Group] Editor Experience Features related to Gutenberg integration on WordPress.com. [Platform] Simple [Pri] Normal [Product] WordPress.com All features accessible on and related to WordPress.com. [Status] Core Fix Needed A fix within the Core WordPress or Gutenberg project is required to resolve this issue. [Status] Priority Review Triggered Quality squad has been notified of this issue in #dotcom-triage-alerts Triaged To be used when issues have been triaged. [Type] Bug
Development

No branches or pull requests

4 participants