From 7527a5c65e1cb1bdd4a92139af2a6e5ddea2d185 Mon Sep 17 00:00:00 2001 From: Ella Iseulde Van Dorpe Date: Tue, 21 Jul 2015 22:45:48 +0000 Subject: [PATCH] Publish box: move focus when the animation is done Also move the focus back to 'edit' when saving changes. Props afercia. Fixes #33060. git-svn-id: https://develop.svn.wordpress.org/trunk@33352 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/comment.js | 5 +++-- src/wp-admin/js/post.js | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/js/comment.js b/src/wp-admin/js/comment.js index 7d5b15b750..b6490fdc2c 100644 --- a/src/wp-admin/js/comment.js +++ b/src/wp-admin/js/comment.js @@ -8,8 +8,9 @@ jQuery(document).ready( function($) { $timestampdiv.siblings('a.edit-timestamp').click( function( event ) { if ( $timestampdiv.is( ':hidden' ) ) { - $timestampdiv.slideDown('fast'); - $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus(); + $timestampdiv.slideDown( 'fast', function() { + $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus(); + } ); $(this).hide(); } event.preventDefault(); diff --git a/src/wp-admin/js/post.js b/src/wp-admin/js/post.js index 01363a3776..9a2da29383 100644 --- a/src/wp-admin/js/post.js +++ b/src/wp-admin/js/post.js @@ -607,7 +607,9 @@ jQuery(document).ready( function($) { $( '#visibility .edit-visibility').click( function () { if ( $postVisibilitySelect.is(':hidden') ) { updateVisibility(); - $postVisibilitySelect.slideDown('fast').find('input[type="radio"]').first().focus(); + $postVisibilitySelect.slideDown( 'fast', function() { + $postVisibilitySelect.find( 'input[type="radio"]' ).first().focus(); + } ); $(this).hide(); } return false; @@ -626,7 +628,7 @@ jQuery(document).ready( function($) { $postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels $postVisibilitySelect.slideUp('fast'); - $('#visibility .edit-visibility').show(); + $('#visibility .edit-visibility').show().focus(); updateText(); if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) { @@ -649,8 +651,9 @@ jQuery(document).ready( function($) { $timestampdiv.siblings('a.edit-timestamp').click( function( event ) { if ( $timestampdiv.is( ':hidden' ) ) { - $timestampdiv.slideDown('fast'); - $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus(); + $timestampdiv.slideDown( 'fast', function() { + $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus(); + } ); $(this).hide(); } event.preventDefault(); @@ -670,7 +673,7 @@ jQuery(document).ready( function($) { $timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels if ( updateText() ) { $timestampdiv.slideUp('fast'); - $timestampdiv.siblings('a.edit-timestamp').show(); + $timestampdiv.siblings('a.edit-timestamp').show().focus(); } event.preventDefault(); }); @@ -690,20 +693,22 @@ jQuery(document).ready( function($) { $postStatusSelect.siblings('a.edit-post-status').click( function( event ) { if ( $postStatusSelect.is( ':hidden' ) ) { - $postStatusSelect.slideDown('fast').find('select').focus(); + $postStatusSelect.slideDown( 'fast', function() { + $postStatusSelect.find('select').focus(); + } ); $(this).hide(); } event.preventDefault(); }); $postStatusSelect.find('.save-post-status').click( function( event ) { - $postStatusSelect.slideUp('fast').siblings('a.edit-post-status').show(); + $postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().focus(); updateText(); event.preventDefault(); }); $postStatusSelect.find('.cancel-post-status').click( function( event ) { - $('#post-status-select').slideUp('fast').siblings( 'a.edit-post-status' ).show().focus(); + $postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().focus(); $('#post_status').val( $('#hidden_post_status').val() ); updateText(); event.preventDefault();