WordPress.org

Make WordPress Core

Changeset 33422


Ignore:
Timestamp:
07/26/2015 02:25:43 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Comment status box: Move focus back to Edit link when changing the date.

props afercia.
fixes #33062.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/comment.js

    r33352 r33422  
    55
    66    var $timestampdiv = $('#timestampdiv'),
    7         stamp = $('#timestamp').html();
     7        $timestamp = $( '#timestamp' ),
     8        stamp = $timestamp.html(),
     9        $timestampwrap = $timestampdiv.find( '.timestamp-wrap' ),
     10        $edittimestamp = $timestampdiv.siblings( 'a.edit-timestamp' );
    811
    9     $timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
     12    $edittimestamp.click( function( event ) {
    1013        if ( $timestampdiv.is( ':hidden' ) ) {
    1114            $timestampdiv.slideDown( 'fast', function() {
    12                 $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
     15                $( 'input, select', $timestampwrap ).first().focus();
    1316            } );
    1417            $(this).hide();
     
    1821
    1922    $timestampdiv.find('.cancel-timestamp').click( function( event ) {
    20         $timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
     23        // Move focus back to the Edit link.
     24        $edittimestamp.show().focus();
     25        $timestampdiv.slideUp( 'fast' );
    2126        $('#mm').val($('#hidden_mm').val());
    2227        $('#jj').val($('#hidden_jj').val());
     
    2429        $('#hh').val($('#hidden_hh').val());
    2530        $('#mn').val($('#hidden_mn').val());
    26         $('#timestamp').html(stamp);
     31        $timestamp.html( stamp );
    2732        event.preventDefault();
    2833    });
     
    3540
    3641        if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) {
    37             $timestampdiv.find('.timestamp-wrap').addClass('form-invalid');
     42            $timestampwrap.addClass( 'form-invalid' );
    3843            return;
    3944        } else {
    40             $timestampdiv.find('.timestamp-wrap').removeClass('form-invalid');
     45            $timestampwrap.removeClass( 'form-invalid' );
    4146        }
    4247
    43         $('#timestamp').html(
     48        $timestamp.html(
    4449            commentL10n.submittedOn + ' <b>' +
    4550            commentL10n.dateFormat
     
    5257        );
    5358
    54         $timestampdiv.slideUp('fast');
    55         $timestampdiv.siblings('a.edit-timestamp').show();
     59        // Move focus back to the Edit link.
     60        $edittimestamp.show().focus();
     61        $timestampdiv.slideUp( 'fast' );
    5662    });
    5763});
Note: See TracChangeset for help on using the changeset viewer.