Comments: Improve accessibility of the "Logged in as" link in comment form.

This changeset ensures the "Logged in as" link conveys the information about its purpose ("Edit your profile") while the information "Logged in as Jane Doe" is only a simple text.

Props juliemoynat, SergeyBiryukov, joedolson, audrasjb, lopo.
Fixes #55718.

Built from https://develop.svn.wordpress.org/trunk@53796


git-svn-id: http://core.svn.wordpress.org/trunk@53355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-07-29 17:06:15 +00:00
parent 221b68fe4b
commit 37c514cc62
2 changed files with 8 additions and 8 deletions

View File

@ -2288,7 +2288,8 @@ function wp_list_comments( $args = array(), $comments = null ) {
* } * }
* @type string $comment_field The comment textarea field HTML. * @type string $comment_field The comment textarea field HTML.
* @type string $must_log_in HTML element for a 'must be logged in to comment' message. * @type string $must_log_in HTML element for a 'must be logged in to comment' message.
* @type string $logged_in_as HTML element for a 'logged in as [user]' message. * @type string $logged_in_as The HTML for the 'logged in as [user]' message, the Edit profile link,
* and the Log out link.
* @type string $comment_notes_before HTML element for a message displayed before the comment fields * @type string $comment_notes_before HTML element for a message displayed before the comment fields
* if the user is not logged in. * if the user is not logged in.
* Default 'Your email address will not be published.'. * Default 'Your email address will not be published.'.
@ -2457,12 +2458,10 @@ function comment_form( $args = array(), $post = null ) {
'logged_in_as' => sprintf( 'logged_in_as' => sprintf(
'<p class="logged-in-as">%s%s</p>', '<p class="logged-in-as">%s%s</p>',
sprintf( sprintf(
/* translators: 1: Edit user link, 2: Accessibility text, 3: User name, 4: Logout URL. */ /* translators: 1: User name, 2: Edit user link, 3: Logout URL. */
__( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ), __( 'Logged in as %1$s. <a href="%2$s">Edit your profile</a>. <a href="%3$s">Log out?</a>' ),
get_edit_user_link(),
/* translators: %s: User name. */
esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
$user_identity, $user_identity,
get_edit_user_link(),
/** This filter is documented in wp-includes/link-template.php */ /** This filter is documented in wp-includes/link-template.php */
wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) ) wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ), $post_id ) )
), ),
@ -2578,7 +2577,8 @@ function comment_form( $args = array(), $post = null ) {
* *
* @since 3.0.0 * @since 3.0.0
* *
* @param string $args_logged_in The logged-in-as HTML-formatted message. * @param string $args_logged_in The HTML for the 'logged in as [user]' message,
* the Edit profile link, and the Log out link.
* @param array $commenter An array containing the comment author's * @param array $commenter An array containing the comment author's
* username, email, and URL. * username, email, and URL.
* @param string $user_identity If the commenter is a registered user, * @param string $user_identity If the commenter is a registered user,

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53795'; $wp_version = '6.1-alpha-53796';
/** /**
* 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.