Make WordPress Core

Changeset 38965


Ignore:
Timestamp:
10/26/2016 05:58:34 PM (8 years ago)
Author:
afercia
Message:

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.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/list-tables.css

    r38672 r38965  
    556556}
    557557
    558 tr.wp-locked .locked-indicator:before {
     558tr.wp-locked .locked-indicator-icon:before {
    559559    color: #82878c;
    560560    content: "\f160";
    561561    display: inline-block;
    562     float: left;
    563562    font: normal 20px/1 dashicons;
    564563    speak: none;
    565564    vertical-align: middle;
    566     margin-left: 0;
    567565    -webkit-font-smoothing: antialiased;
    568566    -moz-osx-font-smoothing: grayscale;
     
    582580
    583581tr.wp-locked .locked-info {
    584     margin-top: 8px;
     582    margin-top: 4px;
    585583    height: auto;
    586584    opacity: 1;
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r38951 r38965  
    836836            ?></label>
    837837            <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
    838             <div class="locked-indicator"></div>
     838            <div class="locked-indicator">
     839                <span class="locked-indicator-icon" aria-hidden="true"></span>
     840                <span class="screen-reader-text"><?php
     841                printf(
     842                    /* translators: %s: post title */
     843                    __( '&#8220;%s&#8221; is locked' ),
     844                    _draft_or_post_title()
     845                );
     846                ?></span>
     847            </div>
    839848        <?php endif;
    840849    }
     
    891900        }
    892901
     902        $can_edit_post = current_user_can( 'edit_post', $post->ID );
     903
     904        if ( $can_edit_post && $post->post_status != 'trash' ) {
     905            $lock_holder = wp_check_post_lock( $post->ID );
     906
     907            if ( $lock_holder ) {
     908                $lock_holder = get_userdata( $lock_holder );
     909                $locked_avatar = get_avatar( $lock_holder->ID, 18 );
     910                $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
     911            } else {
     912                $locked_avatar = $locked_text = '';
     913            }
     914
     915            echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
     916        }
     917
    893918        $pad = str_repeat( '&#8212; ', $this->current_level );
    894919        echo "<strong>";
     
    908933        }
    909934
    910         $can_edit_post = current_user_can( 'edit_post', $post->ID );
    911935        $title = _draft_or_post_title();
    912936
     
    930954        }
    931955        echo "</strong>\n";
    932 
    933         if ( $can_edit_post && $post->post_status != 'trash' ) {
    934             $lock_holder = wp_check_post_lock( $post->ID );
    935 
    936             if ( $lock_holder ) {
    937                 $lock_holder = get_userdata( $lock_holder );
    938                 $locked_avatar = get_avatar( $lock_holder->ID, 18 );
    939                 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
    940             } else {
    941                 $locked_avatar = $locked_text = '';
    942             }
    943 
    944             echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
    945         }
    946956
    947957        if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
Note: See TracChangeset for help on using the changeset viewer.