-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Allow option for Post title to specify tag, or none for no extra markup #30549
Comments
Hey 👋 - so your use case would be to have a Query block with just Because if that's the case it could be something related to |
Running into this issue right now: I'm making a page right now where, semantically, the most appropriate tag to be used for the post title is strictly an I'm totally open to hear other opportunities to do this besides just offering an extra option to do to select the wrapping tag in the sidebar; maybe filters (possibly like #14009 )? Another example of where this be useful is when you'd want to display your posts as an inline list, as requested at #25505 (I ended up making a custom block for my use case; available at https://gitlab.com/cpl/post-title-list-block |
I don't think having no tag would be possible, where would the block's attributes be added? |
In the above PR, using the p tag I think is a tricky situation.
I do not trust users enough. Here are my ideas.
If we introduce this, I almost guarantee we will see long-term broken accessibility just from the simple mistake of selecting a p element. Even if the user made a mistake and selected the heading 5, at least it still follows some heading order. A p element would be invisible as a title identifier. Just trying to think about the time down the road from now. I would rather get this perfect now then to revisit later and have an even bigger challenge to solve. |
This PR by @carolinan |
Here's another request for this feature from @cdils and I'd like to see it too. I completely understand the accessibility concerns around allowing this and I tend to fall in the camp of highly valuing accessibility defaults. Until WordPress 6.3 it was possible to specify the |
I did not know there was a setting that would allow post titles to become paragraphs, that's likely going to haunt us later. If we were to add this, it should be thrown under the Advanced section of the block sidebar. Isn't the title field considered a block now so it has the Block tab? |
Up until WordPress 6.2, the paragraph (i.e. level zero) was supported as attributes internally, even though you couldn't select them in the block toolbar dropdown, so if you update the value of the attribute to zero via the code editor, was being rendered as a WordPress 6.3 and the Gutenberg trunk no longer consider level zero, so it outputs an incorrect tag of My understanding is that there are three choices:
|
The 4th option. Convert |
I'm thinking that if there is an accessibility issue, it might be better to just not allow the p tag itself. I would love to know if anyone has a specific use case where the post title must appear as a p tag. I believe that if we only address the issues raised by this issue, as I have commented here, we can solve the problem by substituting the Latest Posts block. |
Since there is a work-around with the other block, it is likely okay to remove the "0" option. |
@t-hamano My need for it was on a home page template where the Site Name was the I know that I learned about this from other chatter with people and was definitely not the only person using the |
@t-hamano @alexstine The Latest Post block does not accommodate custom post types, so any use case involving CPTs would rely on the Query Loop block.
Using a heading for the post title is not always semantically correct. It depends on the usage context, but this has come up for me in multiple scenarios. For instance, simply creating something akin to the Latest Posts block but with a CPT. My workaround has been registering a block variation using
|
Still interested in what the use-case looks like. I am just having a hard time understanding where and when you would not want the post title to be a heading X. Maybe in some type of list output presentation? Related posts type of thing? |
@alexstine That's a great example. |
Okay, so maybe this moves forward by defaulting to level 1 for heading 1 and users can select level 0 if they choose? I still think adding a warning would be a good step for this just to alert users that it might not be a good idea but possibly okay for their use-case. My main concern, links with just
Thoughts? |
Yep; I made a plugin that for a few sites that I admin that contains a list (using the (ul elment) of most recently published posts' titles. A similar issue would be if someone would want the most recently published posts inline also related types of posts as requested at #25505 |
@skorasaurus If that refers to You probably would not notice this issue at all with Voiceover on Mac due to how flat the navigation method is. |
@alexstine I haven't thought a ton about this yet, but I wonder whether a warning like that should either match the heading warnings in the Document outline or intentionally exceed them. Since this is a heading-related concern, it seems like it would be good to consider it in a full context. It also bring up the fact that the document heading outline doesn't actually include all the headings #5037. |
Full context would be really nice. Flagging errors for the whole page/post. |
I'm circling back around as I'd still like an option to display the Post Title Block as a In a current use case, I'd like to display some latest posts, with each post including a featured image, the post categories, and the post title. The Latest Posts block would be perfect as it outputs the post title in a list (no paragraph or heading needed). The limitation of this block is its inability to display post categories. Moving on to the Query Loop block as an alternative solution to get my desired display, this only lets me display the post title as a heading, which is semantically unnecessary. This is the output:
Possible solutions could include:
For the latter option, I'd support a dev-only option so that use of |
It's very clear that this is a need, and I wonder if this issue should really get folded / referenced in two others:
#32332 makes explicit with @cdils is calling out. The Latest Posts block strangely offers certain features that a lot of us want from the Query Block and the blocks that can go in it like the Post Title block, and yet it feels very "Block Editor 1.0". The Query Block feels like the future, and so it would make sense to deprecate Latest Posts for Query Loop, but only once there is feature parity. #54536 and #58626 talk about ways to get dynamic data in blocks. If we could insert some kind of If these other tickets have real forward momentum, then I can see it making sense to not add this to the Post Title block. However, the merging of Latest Posts and Query Loop doesn't seem to have much momentum, so that may be an argument to do this. |
I would like to use the query block to create something close to the following markup:
The issue is not necessarily the query block but the Post Title block renders as a header tag based on the level, or a
p
tag if thelevel=0
. I would prefer just the title and not the additional markup.A solution could be to specify the tagname for the Post Title block, passing a level and tagname=h can be the default behavior and it works the same, but an empty tagname could just return the title fragment with no markup.
The text was updated successfully, but these errors were encountered: