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

Regression: Post Title block doesn't support paragraph; level:"0" results in <h0> elements #53594

Closed
mrwweb opened this issue Aug 11, 2023 · 8 comments · Fixed by #60548
Closed
Assignees
Labels
[Block] Post Title Affects the Post Title Block [Status] In Progress Tracking issues with work in progress [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Regression Related to a regression in the latest release

Comments

@mrwweb
Copy link

mrwweb commented Aug 11, 2023

Description

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

  1. Paste <!-- wp:post-title {"level":0} /--> into post editor
  2. 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.

No

@carolinan
Copy link
Contributor

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

@carolinan carolinan added the [Block] Post Title Affects the Post Title Block label Aug 12, 2023
@t-hamano
Copy link
Contributor

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.

6 2_heading_dropdown

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.

6 2_paragraph

In WordPress 6.3, it renders as h0, which outputs an error to the browser console.

warning

Therefore, I think it would be a good idea to add a process to migrate blocks with level:0 attributes to level:2, etc.

@jorgefilipecosta
Copy link
Member

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?

@jorgefilipecosta jorgefilipecosta added the [Status] Needs More Info Follow-up required in order to be actionable. label Aug 15, 2023
@mrwweb
Copy link
Author

mrwweb commented 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" 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.

Note: The site title block still supports the level: 0 logic.

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.

@jordesign jordesign added [Type] Discussion For issues that are high-level and not yet ready to implement. [Type] Regression Related to a regression in the latest release and removed [Type] Discussion For issues that are high-level and not yet ready to implement. labels Aug 30, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Sep 15, 2023
@jordesign
Copy link
Contributor

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 jordesign closed this as not planned Won't fix, can't repro, duplicate, stale Oct 26, 2023
@mrwweb
Copy link
Author

mrwweb commented 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.:

<ul>
    <li><a href="">{Post Title}</a></li>
    <li><a href="">{Post Title}</a></li>
    <li><a href="">{Post Title}</a></li>
</ul>

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
Copy link
Author

mrwweb commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Title Affects the Post Title Block [Status] In Progress Tracking issues with work in progress [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants