WordPress.org

Make WordPress Core

Changeset 23763


Ignore:
Timestamp:
03/21/2013 12:57:27 AM (8 years ago)
Author:
azaozz
Message:

Post locks: contain focus inside the dialog when tabbing, remove outline when focus is on the text, see #23697

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.css

    r23753 r23763  
    34123412#notification-dialog .currently-editing {
    34133413    margin-bottom: 20px;
     3414    outline: 0;
    34143415}
    34153416
  • trunk/wp-admin/includes/post.php

    r23742 r23763  
    12161216
    12171217        $preview_link = apply_filters( 'preview_post_link', $preview_link );
     1218        $override = apply_filters( 'override_post_lock', true, $post, $user );
     1219        $tab_last = $override ? '' : ' wp-tab-last';
    12181220
    12191221        ?>
    12201222        <div class="post-locked-message">
    12211223        <div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
    1222         <p class="currently-editing" tabindex="0"><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p>
     1224        <p class="currently-editing wp-tab-first" tabindex="0"><?php esc_html_e( sprintf( __( 'This content is currently locked. If you take over, %s will be blocked from continuing to edit.' ), $user->display_name ) ); ?></p>
    12231225        <p>
    12241226        <a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
    1225         <a class="button" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
     1227        <a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
    12261228        <?php
    12271229
    12281230        // Allow plugins to prevent some users overriding the post lock
    1229         if ( apply_filters( 'override_post_lock', true, $post, $user ) ) {
     1231        if ( $override ) {
    12301232            ?>
    1231             <a class="button button-primary" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
     1233            <a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
    12321234            <?php
    12331235        }
     
    12411243        <div class="post-taken-over">
    12421244            <div class="post-locked-avatar"></div>
    1243             <p class="currently-editing" tabindex="0"></p>
    1244             <p><a class="button button-primary" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
     1245            <p class="currently-editing wp-tab-first" tabindex="0"></p>
     1246            <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
    12451247        </div>
    12461248        <?php
  • trunk/wp-admin/js/post.js

    r23733 r23763  
    300300    postboxes.add_postbox_toggles(pagenow);
    301301
    302     // Post locks: if the Post Locked dialog is shown, focus it.
    303     $('#notification-dialog:visible').find('p.currently-editing').focus();
     302    // Post locks: contain focus inside the dialog. If the dialog is shown, focus the first item.
     303    $('#notification-dialog').on( 'keydown', function(e) {
     304        if ( e.which != 9 )
     305            return;
     306
     307        var target = $(e.target);
     308
     309        if ( target.hasClass('wp-tab-first') && e.shiftKey ) {
     310            $(this).find('.wp-tab-last').focus();
     311            e.preventDefault();
     312        } else if ( target.hasClass('wp-tab-last') && ! e.shiftKey ) {
     313            $(this).find('.wp-tab-first').focus();
     314            e.preventDefault();
     315        }
     316    }).filter(':visible').find('.wp-tab-first').focus();
    304317
    305318    // multi-taxonomies
Note: See TracChangeset for help on using the changeset viewer.