Make WordPress Core

Changeset 23733


Ignore:
Timestamp:
03/16/2013 08:46:37 PM (12 years ago)
Author:
azaozz
Message:

Post locks: when a dialog is shown move focus to the text, see #23697

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r23725 r23733  
    12311231        <div class="post-locked-message">
    12321232        <div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
    1233         <p><?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>
     1233        <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>
    12341234        <p>
    12351235        <a class="button" href="<?php echo esc_url( wp_get_referer() ); ?>"><?php _e('Go back'); ?></a>
     
    12521252        <div class="post-taken-over">
    12531253            <div class="post-locked-avatar"></div>
    1254             <p class="currently-editing"></p>
     1254            <p class="currently-editing" tabindex="0"></p>
    12551255            <p><a class="button button-primary" href="<?php echo esc_url( admin_url('edit.php') ); ?>"><?php _e('Go to All Posts'); ?></a></p>
    12561256        </div>
  • trunk/wp-admin/js/post.js

    r23725 r23733  
    266266});
    267267
     268// Post locks: update the lock string or show the dialog if somebody has taken over editing
    268269$(document).on( 'heartbeat-tick.refresh-lock', function( e, data ) {
    269270    var received, wrap, avatar;
     
    278279            if ( ! wrap.is(':visible') ) {
    279280                autosave();
    280                 wrap.find('p.currently-editing').text( received.lock_error.text );
    281                
     281
    282282                if ( received.lock_error.avatar_src ) {
    283283                    avatar = $('<img class="avatar avatar-64 photo" width="64" height="64" />').attr( 'src', received.lock_error.avatar_src.replace(/&amp;/g, '&') );
     
    285285                }
    286286
    287                 wrap.show();
    288             }
     287                wrap.show().find('p.currently-editing').text( received.lock_error.text ).focus();
     288            }
     289        } else if ( received.new_lock ) {
     290            $('#active_post_lock').val( received.new_lock );
    289291        }
    290 
    291         if ( received['new_lock'] )
    292             $('#active_post_lock').val( received['new_lock'].replace(/[^0-9:]+/, '') );
    293292    }
    294293});
     
    300299
    301300    postboxes.add_postbox_toggles(pagenow);
     301
     302    // Post locks: if the Post Locked dialog is shown, focus it.
     303    $('#notification-dialog:visible').find('p.currently-editing').focus();
    302304
    303305    // multi-taxonomies
Note: See TracChangeset for help on using the changeset viewer.