Skip to content

Bugs with autogenerated heading anchorsΒ #36365

@paulwilde

Description

@paulwilde

Description

I wrote a comment on the feature pull request about a week ago but given it's already a closed pull request it likely got lost.

There's currently some issues with the autogenerated heading anchors that are increasingly frustrating as someone who has been building a website with the latest version of Gutenberg with this feature in place.

  1. There is a bug where if you write a heading and then duplicate that block the old id is retained even if you change the text for the duplicated heading.
  2. It doesn't take into consideration ids from different editor settings (such as widgets) so you can end up with duplicate ids on the page from the main editor and widgets. If you were also to use a block template theme that would increase to 3 different areas that can produce duplicate ids.
  3. There is currently no flag to disable the functionality. Not speaking as someone who does this, but I can see this having negative consequences on websites where people have used ids for JavaScript hooks or styling the template, and the generated ids have the potential to completely break the website.

Step-by-step reproduction instructions

See above.

Screenshots, screen recording, code snippet

No response

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DevReady for, and needs developer efforts[Block] HeadingAffects the Headings Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions