Accessibility: Remove title attributes from the Posts list table.

Fixes #35313.
Built from https://develop.svn.wordpress.org/trunk@36333


git-svn-id: http://core.svn.wordpress.org/trunk@36300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-01-17 15:47:26 +00:00
parent 97e367483a
commit 497de1d658
2 changed files with 63 additions and 14 deletions

View File

@ -877,8 +877,14 @@ class WP_Posts_List_Table extends WP_List_Table {
$title = _draft_or_post_title();
if ( $can_edit_post && $post->post_status != 'trash' ) {
$edit_link = get_edit_post_link( $post->ID );
echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
printf(
'<a class="row-title" href="%s" aria-label="%s">%s%s</a>',
get_edit_post_link( $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $title ) ),
$pad,
$title
);
} else {
echo $pad . $title;
}
@ -1169,31 +1175,74 @@ class WP_Posts_List_Table extends WP_List_Table {
$post_type_object = get_post_type_object( $post->post_type );
$can_edit_post = current_user_can( 'edit_post', $post->ID );
$actions = array();
$title = _draft_or_post_title();
if ( $can_edit_post && 'trash' != $post->post_status ) {
$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
$actions['edit'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
get_edit_post_link( $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
__( 'Edit' )
);
$actions['inline hide-if-no-js'] = sprintf(
'<a href="#" class="editinline" aria-label="%s">%s</a>',
/* translators: %s: post title */
esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
__( 'Quick&nbsp;Edit' )
);
}
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( 'trash' === $post->post_status )
$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>";
if ( 'trash' === $post->post_status || !EMPTY_TRASH_DAYS )
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
if ( 'trash' === $post->post_status ) {
$actions['untrash'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
/* translators: %s: post title */
esc_attr__( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $title ) ),
__( 'Restore' )
);
} elseif ( EMPTY_TRASH_DAYS ) {
$actions['trash'] = sprintf(
'<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
get_delete_post_link( $post->ID ),
/* translators: %s: post title */
esc_attr__( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $title ) ),
_x( 'Trash', 'verb' )
);
}
if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
$actions['delete'] = sprintf(
'<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
get_delete_post_link( $post->ID, '', true ),
/* translators: %s: post title */
esc_attr__( sprintf( __( 'Delete &#8220;%s&#8221; permanently' ), $title ) ),
__( 'Delete Permanently' )
);
}
}
if ( is_post_type_viewable( $post_type_object ) ) {
$title = _draft_or_post_title();
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
if ( $can_edit_post ) {
$unpublished_link = set_url_scheme( get_permalink( $post ) );
$preview_link = get_preview_post_link( $post, array(), $unpublished_link );
$actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
$actions['view'] = sprintf(
'<a href="%s" rel="permalink" aria-label="%s">%s</a>',
esc_url( $preview_link ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ),
__( 'Preview' )
);
}
} elseif ( 'trash' != $post->post_status ) {
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
$actions['view'] = sprintf(
'<a href="%s" rel="permalink" aria-label="%s">%s</a>',
get_permalink( $post->ID ),
/* translators: %s: post title */
esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ),
__( 'View' )
);
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-1453042813410';
$wp_version = '4.5-alpha-1453045632755';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.