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. git-svn-id: https://develop.svn.wordpress.org/trunk@38965 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
16768b39cf
commit
29e75c5d77
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
__( '“%s” 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( '— ', $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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user