You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: Post Title block doesn't support paragraph; level:"0" results in <h0> elements #53594
Previously, the Post Title block offered the option to display the post title in a paragraph tag. It appears that this was removed in 6.3 (also here) as part of the work to pull the HeadingLevelDropdown into its own component. Given that the component supports a paragraph tag when level: "0", I don't understand why this was removed.
I have a site using a Post Title block with level: "0". In 6.2, it outputs a paragraph. In 6.3, it creates an h0 element that results in some styling issues for us. Notably, the block doesn't appear to have any validation issues, I think because 0 is expected as a supported value of the level attribute (as it should be).
Given that this was previously supported and produces an invalid HTML element, this feels like a fairly urgent issue worth addressing in a point release.
Tagging the three people who worked on the relevant commit in hopes of gaining some context: @carolinan, @geriux, @Mamaduka
Step-by-step reproduction instructions
Paste <!-- wp:post-title {"level":0} /--> into post editor
View resulting post markup with <h0> elements around the Post Title
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.3
No Gutenberg plugin
Custom theme
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Hi, It has been more than 6 months, so my memory is not super fresh, but through my testing when working on the block, what I found was that using the post title as a paragraph was never actually supported. https://github.com/WordPress/gutenberg/pull/46003/files#r1031159154
Can you explain to me in detail how this was used? Did you perhaps add the paragraph "level" directly via the HTML in the markup, not via the interface?
With the interface, I mean the drop-down with the levels in the block toolbar, the drop-down did not support paragraphs.
I personally wanted this to be supported, but it was downvoted in discussions, for accessibility reasons: #30549
I tested it with WordPress 6.2.2, and there are indeed no paragraph in the Post Title block dropdown, so I don't think it could be a paragraph block unless you intentionally set the level attribute to zero.
Also, I think it was easy to notice that this was not the intent, because if level:0 was specified, nothing would be rendered in the dropdown icon.
In WordPress 6.3, it renders as h0, which outputs an error to the browser console.
Therefore, I think it would be a good idea to add a process to migrate blocks with level:0 attributes to level:2, etc.
Therefore, I think it would be a good idea to add a process to migrate blocks with level:0 attributes to level:2, etc.
Based on the discussion, the UI has never allowed the selection of level 0. So, I suppose it's not a migration that core needs to include for every site. It appears that websites depending on manually altering an attribute to level 0 in the code editor should implement this kind of migration that's specific to them. If that's the case, can we close the issue?
It's been about ~9 months since the page in question was made, so I cannot fully remember either. If I did it manually, I'm almost positive that all I did was change level: "1" to level: "0" in the block's attribute comments. I could have also made a Block Pattern or created a Block Variation.
I'm with @carolinan and others wishing this were supported, ironically for accessibility reasons so I can have a post template (on the home page) referencing the post title which is not the h1 on that template.
I suppose we could close this as a duplicate of #30549. What gives me pause is that it just feels weird that this was explicitly supported in the code for multiple versions of WordPress. I understand there wasn't a UI for it, but does that mean that any undocumented attribute is considered experimental unless there's any explicit UI for it? Could the support for the 0 attribute be added back explicitly without a UI. That would at least address the accessibility concerns raised since it would require that you "know what you're doing" to get the paragraph output.
Pardon me for all the thinking out loud here. I'll follow the consensus, but it would just be nice to understand the precedents.
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.
With no further discussion on this issue - and no additional reports, I will close it. If we receive more reports in the future we can open once again.
@jordesign The other day I ran into a very real use-case for this feature. I'd love to hide the Latest Post block on my sites and instead use the Query Block as a replacement. However, since the Post Title must always be a heading, it's actually impossible to use it as a like-for-like replacement if I want to make a stripped down list of posts, e.g.:
It's possible that a "Level 0" isn't exactly the right solution for this use-case, but it definitely once-again raises the need for an option to use the Post Title block without the heading markup.
As another point in favor of supporting a non-heading markup option, @afercia just pointed out on #50402 that the Site Title block does still offer a Paragraph option in the heading selector.
Activity
carolinan commentedon Aug 12, 2023
Hi,
It has been more than 6 months, so my memory is not super fresh, but through my testing when working on the block, what I found was that using the post title as a paragraph was never actually supported.
https://github.com/WordPress/gutenberg/pull/46003/files#r1031159154
Can you explain to me in detail how this was used? Did you perhaps add the paragraph "level" directly via the HTML in the markup, not via the interface?
With the interface, I mean the drop-down with the levels in the block toolbar, the drop-down did not support paragraphs.
I personally wanted this to be supported, but it was downvoted in discussions, for accessibility reasons:
#30549
t-hamano commentedon Aug 12, 2023
I tested it with WordPress 6.2.2, and there are indeed no paragraph in the Post Title block dropdown, so I don't think it could be a paragraph block unless you intentionally set the
levelattribute to zero.Also, I think it was easy to notice that this was not the intent, because if
level:0was specified, nothing would be rendered in the dropdown icon.In WordPress 6.3, it renders as
h0, which outputs an error to the browser console.Therefore, I think it would be a good idea to add a process to migrate blocks with
level:0attributes tolevel:2, etc.jorgefilipecosta commentedon Aug 15, 2023
Based on the discussion, the UI has never allowed the selection of level 0. So, I suppose it's not a migration that core needs to include for every site. It appears that websites depending on manually altering an attribute to level 0 in the code editor should implement this kind of migration that's specific to them. If that's the case, can we close the issue?
mrwweb commentedon Aug 15, 2023
It's been about ~9 months since the page in question was made, so I cannot fully remember either. If I did it manually, I'm almost positive that all I did was change
level: "1"tolevel: "0"in the block's attribute comments. I could have also made a Block Pattern or created a Block Variation.I'm with @carolinan and others wishing this were supported, ironically for accessibility reasons so I can have a post template (on the home page) referencing the post title which is not the
h1on that template.Note: The site title block still supports the
level: 0logic.I suppose we could close this as a duplicate of #30549. What gives me pause is that it just feels weird that this was explicitly supported in the code for multiple versions of WordPress. I understand there wasn't a UI for it, but does that mean that any undocumented attribute is considered experimental unless there's any explicit UI for it? Could the support for the
0attribute be added back explicitly without a UI. That would at least address the accessibility concerns raised since it would require that you "know what you're doing" to get the paragraph output.Pardon me for all the thinking out loud here. I'll follow the consensus, but it would just be nice to understand the precedents.
github-actions commentedon Sep 15, 2023
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.
jordesign commentedon Oct 26, 2023
With no further discussion on this issue - and no additional reports, I will close it. If we receive more reports in the future we can open once again.
mrwweb commentedon Nov 8, 2023
@jordesign The other day I ran into a very real use-case for this feature. I'd love to hide the Latest Post block on my sites and instead use the Query Block as a replacement. However, since the Post Title must always be a heading, it's actually impossible to use it as a like-for-like replacement if I want to make a stripped down list of posts, e.g.:
It's possible that a "Level 0" isn't exactly the right solution for this use-case, but it definitely once-again raises the need for an option to use the Post Title block without the heading markup.
mrwweb commentedon Nov 10, 2023
@jordesign Still hoping to get this re-opened.
As another point in favor of supporting a non-heading markup option, @afercia just pointed out on #50402 that the Site Title block does still offer a Paragraph option in the heading selector.