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
This commit is contained in:
Ella Iseulde Van Dorpe 2015-07-21 22:45:48 +00:00
parent fd0c1665f8
commit 7527a5c65e
2 changed files with 16 additions and 10 deletions

View File

@ -8,8 +8,9 @@ jQuery(document).ready( function($) {
$timestampdiv.siblings('a.edit-timestamp').click( function( event ) { $timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
if ( $timestampdiv.is( ':hidden' ) ) { if ( $timestampdiv.is( ':hidden' ) ) {
$timestampdiv.slideDown('fast'); $timestampdiv.slideDown( 'fast', function() {
$( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus(); $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
} );
$(this).hide(); $(this).hide();
} }
event.preventDefault(); event.preventDefault();

View File

@ -607,7 +607,9 @@ jQuery(document).ready( function($) {
$( '#visibility .edit-visibility').click( function () { $( '#visibility .edit-visibility').click( function () {
if ( $postVisibilitySelect.is(':hidden') ) { if ( $postVisibilitySelect.is(':hidden') ) {
updateVisibility(); updateVisibility();
$postVisibilitySelect.slideDown('fast').find('input[type="radio"]').first().focus(); $postVisibilitySelect.slideDown( 'fast', function() {
$postVisibilitySelect.find( 'input[type="radio"]' ).first().focus();
} );
$(this).hide(); $(this).hide();
} }
return false; return false;
@ -626,7 +628,7 @@ jQuery(document).ready( function($) {
$postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels $postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels
$postVisibilitySelect.slideUp('fast'); $postVisibilitySelect.slideUp('fast');
$('#visibility .edit-visibility').show(); $('#visibility .edit-visibility').show().focus();
updateText(); updateText();
if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) { if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) {
@ -649,8 +651,9 @@ jQuery(document).ready( function($) {
$timestampdiv.siblings('a.edit-timestamp').click( function( event ) { $timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
if ( $timestampdiv.is( ':hidden' ) ) { if ( $timestampdiv.is( ':hidden' ) ) {
$timestampdiv.slideDown('fast'); $timestampdiv.slideDown( 'fast', function() {
$( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus(); $( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
} );
$(this).hide(); $(this).hide();
} }
event.preventDefault(); event.preventDefault();
@ -670,7 +673,7 @@ jQuery(document).ready( function($) {
$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels $timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
if ( updateText() ) { if ( updateText() ) {
$timestampdiv.slideUp('fast'); $timestampdiv.slideUp('fast');
$timestampdiv.siblings('a.edit-timestamp').show(); $timestampdiv.siblings('a.edit-timestamp').show().focus();
} }
event.preventDefault(); event.preventDefault();
}); });
@ -690,20 +693,22 @@ jQuery(document).ready( function($) {
$postStatusSelect.siblings('a.edit-post-status').click( function( event ) { $postStatusSelect.siblings('a.edit-post-status').click( function( event ) {
if ( $postStatusSelect.is( ':hidden' ) ) { if ( $postStatusSelect.is( ':hidden' ) ) {
$postStatusSelect.slideDown('fast').find('select').focus(); $postStatusSelect.slideDown( 'fast', function() {
$postStatusSelect.find('select').focus();
} );
$(this).hide(); $(this).hide();
} }
event.preventDefault(); event.preventDefault();
}); });
$postStatusSelect.find('.save-post-status').click( function( event ) { $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(); updateText();
event.preventDefault(); event.preventDefault();
}); });
$postStatusSelect.find('.cancel-post-status').click( function( event ) { $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() ); $('#post_status').val( $('#hidden_post_status').val() );
updateText(); updateText();
event.preventDefault(); event.preventDefault();