Customizer: Track the link that was used to open the customizer and restore focus on close. props lessbloat. fixes #21283.
git-svn-id: http://core.svn.wordpress.org/trunk@22756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e276fc44be
commit
7a4b96d78f
|
@ -881,9 +881,8 @@
|
||||||
$('.back').keydown( function( event ) {
|
$('.back').keydown( function( event ) {
|
||||||
if ( 9 === event.which ) // tab
|
if ( 9 === event.which ) // tab
|
||||||
return;
|
return;
|
||||||
var thisHref = $(this).attr('href');
|
|
||||||
if ( 13 === event.which ) // enter
|
if ( 13 === event.which ) // enter
|
||||||
window.location = thisHref;
|
parent.send( 'close' );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,10 @@ window.wp = window.wp || {};
|
||||||
$('#wpbody').on( 'click', '.load-customize', function( event ) {
|
$('#wpbody').on( 'click', '.load-customize', function( event ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Store a reference to the link that opened the customizer.
|
||||||
|
Loader.link = $(this);
|
||||||
// Load the theme.
|
// Load the theme.
|
||||||
Loader.open( $(this).attr('href') );
|
Loader.open( Loader.link.attr('href') );
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add navigation listeners.
|
// Add navigation listeners.
|
||||||
|
@ -123,6 +125,10 @@ window.wp = window.wp || {};
|
||||||
this.active = false;
|
this.active = false;
|
||||||
|
|
||||||
this.trigger( 'close' );
|
this.trigger( 'close' );
|
||||||
|
|
||||||
|
// Return focus to link that was originally clicked.
|
||||||
|
if ( this.link )
|
||||||
|
this.link.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
closed: function() {
|
closed: function() {
|
||||||
|
|
Loading…
Reference in New Issue