WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#36364 closed enhancement (invalid)

Change the heading H3 to H2 of 'Leave a Reply’, comment_form() for the accessibility

Reported by: kassy000 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords:
Focuses: accessibility Cc:

Description

When I receiving the accessibility review of the theme I created, the theme reviewer required change the heading up from H3 to H2 of 'Leave a Reply’. Here the comment of the theme reviewer.

5) Headings: Fail

Move 'Leave a Reply' heading up to H2 and it passes.

https://themes.trac.wordpress.org/ticket/28202#comment:38

It’s seem to there are a code that able to change from H3 to H2 in comment.php of the default theme,Twenty Sixteen. But When activated other themes, It’s need to insert params to comment.php,comment_form() manually.

Example:

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

So,I make a suggestion change the code of ‘wp-include/comment-templates.php’

line 2095 to 2097 of ‘wp-include/comment-templates.php’

 *     @type string $title_reply_before   HTML displayed before the comment form title.
 *                                        Default: '<h3 id="reply-title" class="comment-reply-title">'.
 *     @type string $title_reply_after    HTML displayed after the comment form title.
 *                                        Default: '</h3>'.

Fixed code

 *     @type string $title_reply_before   HTML displayed before the comment form title.
 *                                        Default: '<h2 id="reply-title" class="comment-reply-title">'.
 *     @type string $title_reply_after    HTML displayed after the comment form title.
 *                                        Default: '</h2>'.

line 2174 to 2175

'title_reply_before'   => '<h3 id="reply-title" class="comment-reply-title">',
'title_reply_after'    => '</h3>',

Fixed code

'title_reply_before'   => '<h2 id="reply-title" class="comment-reply-title">',
'title_reply_after'    => '</h2>',

Attachments (2)

comment-template.php (82.4 KB) - added by kassy000 2 years ago.
comment-template.patch (1.8 KB) - added by kassy000 2 years ago.

Download all attachments as: .zip

Change History (11)

#1 @kassy000
2 years ago

  • Type changed from feature request to enhancement

#2 @kassy000
2 years ago

  • Summary changed from Change headings H3 to H2 of 'Leave a Reply’, comment_form(). to Change headings H3 to H2 of 'Leave a Reply’, comment_form(). for the accessibility.

#3 @kassy000
2 years ago

  • Summary changed from Change headings H3 to H2 of 'Leave a Reply’, comment_form(). for the accessibility. to Change the heading H3 to H2 of 'Leave a Reply’, comment_form(). for the accessibility.

#4 @kassy000
2 years ago

  • Summary changed from Change the heading H3 to H2 of 'Leave a Reply’, comment_form(). for the accessibility. to Change the heading H3 to H2 of 'Leave a Reply’, comment_form() for the accessibility

#5 @joedolson
2 years ago

This isn't really a simple solution. The H3 was only wrong because of the context it was in within your theme -- because the previous heading was an H1, H3 was a problem. However, if the prior heading was an H2, it would have been perfectly correct.

Either option here can cause problems; it just depends on which set of problems it will cause. Currently, it's likely to cause problems with themes that use an H1 for their primary post heading; with this change, it would work fine for those, but cause problems with themes using an H2 or lower for their post heading.

On that point, I'm fairly indifferent to whether this changes in core. However, I will observe that changing core HTML output has a lot of impact on how people's sites will render, and I'm not sure this change would be worth causing that impact.

#6 @chriscct7
2 years ago

  • Version trunk deleted

#7 @kassy000
2 years ago

Hi @joedolson

I'm sorry for late replay.

As you said, depending on what use the theme, this solution will be correct or wrong.

I can't figure out the new idea soon. If I come up with a good idea, I'll create a ticket again.

Thank you.

#8 @kassy000
2 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#9 @ocean90
2 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.