-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: prevent headings of template from rendering in list in Site Editor #54385
Comments
FYI @Mamaduka is currently working on some enhancements for the block. Not sure if this is included or not. |
Yes, this is on my list. |
Came here to report this too after I found it showed the Comments block heading: table.of.contents.bug.mov |
@ntsekouras, can you provide steps on how I can reproduce the error described here - #51477 (comment). |
|
I just tested the above scenario with #54224. There's no error, and the editor doesn't crash when viewing template-swapping options. I can still see extra headings from the templates. |
Hope the video helps to reproduce. Screen.Recording.2023-09-13.at.2.02.02.PM.mov |
@ntsekouras, I meant that I can reproduce the error on |
I can still reproduce this. If I add the TOC to the single post template.... ... it lists the headings footer's template, not in the post content: That said, fixing #41173 will also fix this issue so I will close this one. |
Description
If we have page that contains a Table of Contents block and we view this page in the site editor, the block also renders the other template headers. I'm not sure if this is something known and if is something wrong with how the
headings
are assigned to that block.This might be serious enough because of the side effects of the block to update its attributes based on existing static markup and the discovery method it uses to find
headings
. In such a case if we render the template in a BlockPreview, it crashes the browser. It was discovered here. It seems that by using getClientIdsWithDescendants when we are in site editor has unexpected results.Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Screen.Recording.2023-09-12.at.5.19.49.PM.mov
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: