Administration: Better accessibility for the "Post locked" indicator.

- hides the locked icon from assistive technologies
- adds hidden text to indicate the post is locked
- moves the info about who's currently editing to the top of the title table cell

Props mariovalney.
Fixes #38185.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-10-26 17:59:29 +00:00
parent a6df2cced5
commit 6fe17e2a3d
6 changed files with 33 additions and 27 deletions

View File

@ -555,15 +555,13 @@ tr.wp-locked .locked-indicator {
width: 16px;
}
tr.wp-locked .locked-indicator:before {
tr.wp-locked .locked-indicator-icon:before {
color: #82878c;
content: "\f160";
display: inline-block;
float: right;
font: normal 20px/1 dashicons;
speak: none;
vertical-align: middle;
margin-right: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@ -581,7 +579,7 @@ tr .locked-info {
}
tr.wp-locked .locked-info {
margin-top: 8px;
margin-top: 4px;
height: auto;
opacity: 1;
}

File diff suppressed because one or more lines are too long

View File

@ -555,15 +555,13 @@ tr.wp-locked .locked-indicator {
width: 16px;
}
tr.wp-locked .locked-indicator:before {
tr.wp-locked .locked-indicator-icon:before {
color: #82878c;
content: "\f160";
display: inline-block;
float: left;
font: normal 20px/1 dashicons;
speak: none;
vertical-align: middle;
margin-left: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@ -581,7 +579,7 @@ tr .locked-info {
}
tr.wp-locked .locked-info {
margin-top: 8px;
margin-top: 4px;
height: auto;
opacity: 1;
}

File diff suppressed because one or more lines are too long

View File

@ -835,7 +835,16 @@ class WP_Posts_List_Table extends WP_List_Table {
printf( __( 'Select %s' ), _draft_or_post_title() );
?></label>
<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
<div class="locked-indicator"></div>
<div class="locked-indicator">
<span class="locked-indicator-icon" aria-hidden="true"></span>
<span class="screen-reader-text"><?php
printf(
/* translators: %s: post title */
__( '&#8220;%s&#8221; is locked' ),
_draft_or_post_title()
);
?></span>
</div>
<?php endif;
}
@ -890,6 +899,22 @@ class WP_Posts_List_Table extends WP_List_Table {
}
}
$can_edit_post = current_user_can( 'edit_post', $post->ID );
if ( $can_edit_post && $post->post_status != 'trash' ) {
$lock_holder = wp_check_post_lock( $post->ID );
if ( $lock_holder ) {
$lock_holder = get_userdata( $lock_holder );
$locked_avatar = get_avatar( $lock_holder->ID, 18 );
$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
} else {
$locked_avatar = $locked_text = '';
}
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
}
$pad = str_repeat( '&#8212; ', $this->current_level );
echo "<strong>";
@ -907,7 +932,6 @@ class WP_Posts_List_Table extends WP_List_Table {
echo $this->get_edit_link( $format_args, $label . ':', $format_class );
}
$can_edit_post = current_user_can( 'edit_post', $post->ID );
$title = _draft_or_post_title();
if ( $can_edit_post && $post->post_status != 'trash' ) {
@ -930,20 +954,6 @@ class WP_Posts_List_Table extends WP_List_Table {
}
echo "</strong>\n";
if ( $can_edit_post && $post->post_status != 'trash' ) {
$lock_holder = wp_check_post_lock( $post->ID );
if ( $lock_holder ) {
$lock_holder = get_userdata( $lock_holder );
$locked_avatar = get_avatar( $lock_holder->ID, 18 );
$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
} else {
$locked_avatar = $locked_text = '';
}
echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
}
if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
the_excerpt();
}

View File

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