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

Post Comments Form: Make heading customizable #43681

Open
ockham opened this issue Aug 29, 2022 · 1 comment · May be fixed by #43687
Open

Post Comments Form: Make heading customizable #43681

ockham opened this issue Aug 29, 2022 · 1 comment · May be fixed by #43687
Assignees
Labels
[Block] Post Comments Form Affects the Comments Form Block Needs Design Feedback Needs general design feedback. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@ockham
Copy link
Contributor

ockham commented Aug 29, 2022

What problem does this address?

Required to fix #43203. Quoting the most relevant part:

Pulling out of this trac issue on adding an "accessibility ready" tag for the Twenty Twenty-Two Theme. From @carolinan who did the audit:

On single posts or pages, when comments are enabled, the site title is an H1, the post title is an H1, but the next title is the "Leave a Reply" title and it is an H3, so the H2 level is skipped.
If there are comments, the "One response to “title” is present, but it is also an H3:
H1 Site Title
H1 Sample Page
H3 One response to “Sample Page”
H3 Leave a Reply

While TT2 uses the (legacy) Post Comments block, a similar issue applies to block themes that use the (newer) Comments block, which in turn uses the Comments Title and Post Comments Form block: While the Comments Title block ("One response to...") allows customization of the heading level (and defaults to H2), the Post Comments Form block is a thin wrapper around the comment_form() function (docs). While that function supports customization of the heading, it is not currently exposed via block controls, and defaults to H3. This means that there still is an a11y issue for posts that don't have any comments posted (yet):

H1 Sample Page
H3 Leave a reply

What is your proposed solution?

As discussed in WordPress/wordpress-develop#3136 (comment): Make the Post Comments Form block heading level customizable.

The required code change for the frontend is pretty simple:

comment_form(
	array(
		'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
		'title_reply_after'  => '</h2>'
	)
);

Note that in the long run, we plan to turn the "monolithic" Post Comments Form block into a "composable" block with child blocks such as Comment Author Field, Comment Content field, etc (#38107) -- much like we've already done when introducing the Comments block as a replacement for the Post Comments one. However, there's no ETA for this, and we might want to offer this basic customization of the heading level already.

IMO, the big question is if it's weird to have "only" one (somewhat random?) customization option on the Post Comments Form block -- and if it's weird to have a heading level control on a block that's more than just a heading. Curious to hear our designers' thoughts 😄

image

@ockham ockham added Needs Design Feedback Needs general design feedback. [Block] Post Comments Form Affects the Comments Form Block labels Aug 29, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 29, 2022
@richtabor
Copy link
Member

Related #40320

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Comments Form Affects the Comments Form Block Needs Design Feedback Needs general design feedback. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants