-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
[Block] HeadingAffects the Headings BlockAffects the Headings Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
What problem does this address?
The autogenerated HTML anchors introduced in Gutenberg 11.8 can create conflicts in some instances, like when duplicating Heading blocks or when users manually set an id, as it is not checked whether the same HTML ID exists on the page.
What is your proposed solution?
Adding a prefix to the anchors with the block name would avoid most conflicts with manually set IDs, except for particular situations. It would not prevent duplicate HTML IDs if two or more headings contain the same text, which semantically is not ideal anyway. Some options to consider:
- Adding a block name prefix (
header-mytitle) - Adding the block name and heading level (
header-h3-mytitle): this can prevent conflicts between different heading levels with the same block, but the anchor would change if the user changes the heading level.
In any case, this prefix should be customizable with the help of a hook.
skorasaurus and ram108
Metadata
Metadata
Assignees
Labels
[Block] HeadingAffects the Headings BlockAffects the Headings Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.