Accessibility: Comments: In `comment_form()`, remove `aria-describedby` attribute from the email field if there's no associated description in the `comment_notes_before` argument.
The attribute is meant to communicate to user agents and assistive technologies that the element has a description. If the referenced description is missing, it will be flagged as failure by any automated accessibility checker tool and, most importantly, is potentially confusing for assistive technologies users. Props afercia, joedolson, dinhtungdu, donmhico, SergeyBiryukov. Fixes #47975. Built from https://develop.svn.wordpress.org/trunk@46090 git-svn-id: http://core.svn.wordpress.org/trunk@45902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4d1761c881
commit
5289afac9b
|
@ -2428,6 +2428,15 @@ function comment_form( $args = array(), $post_id = null ) {
|
||||||
// Ensure that the filtered args contain all required default values.
|
// Ensure that the filtered args contain all required default values.
|
||||||
$args = array_merge( $defaults, $args );
|
$args = array_merge( $defaults, $args );
|
||||||
|
|
||||||
|
// Remove aria-describedby from the email field if there's no associated description.
|
||||||
|
if ( false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) {
|
||||||
|
$args['fields']['email'] = str_replace(
|
||||||
|
' aria-describedby="email-notes"',
|
||||||
|
'',
|
||||||
|
$args['fields']['email']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires before the comment form.
|
* Fires before the comment form.
|
||||||
*
|
*
|
||||||
|
@ -2509,7 +2518,7 @@ function comment_form( $args = array(), $post_id = null ) {
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Prepare an array of all fields, including the textarea
|
// Prepare an array of all fields, including the textarea.
|
||||||
$comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields'];
|
$comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-46089';
|
$wp_version = '5.3-alpha-46090';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue