Ticket #21283: 21283.15.diff

File 21283.15.diff, 1.7 KB (added by lessbloat, 6 months ago)
Line 
1Index: wp-includes/js/customize-loader.js
2===================================================================
3--- wp-includes/js/customize-loader.js  (revision 22724)
4+++ wp-includes/js/customize-loader.js  (working copy)
5@@ -29,7 +29,7 @@
6                                event.preventDefault();
7 
8                                // Load the theme.
9-                               Loader.open( $(this).attr('href') );
10+                               Loader.open( $(this).attr('href'), $(this) );
11                        });
12 
13                        // Add navigation listeners.
14@@ -60,7 +60,7 @@
15                                Loader.close();
16                },
17 
18-               open: function( src ) {
19+               open: function( src, linkClicked ) {
20                        var hash;
21 
22                        if ( this.active )
23@@ -109,6 +109,10 @@
24                                history.pushState( { customize: src }, '', src );
25                        else if ( ! $.support.history && $.support.hashchange && hash )
26                                window.location.hash = 'wp_customize=on&' + hash;
27+                       
28+                       // Capture link id to return focus to after closing customizer
29+                       if ( linkClicked )
30+                               _wpCustomizeLoaderSettings[ 'returnFocus' ]     = linkClicked;
31 
32                        this.trigger( 'open' );
33                },
34@@ -123,6 +127,9 @@
35                        this.active = false;
36 
37                        this.trigger( 'close' );
38+                       
39+                       // Return focus to link that was originally clicked
40+                       _wpCustomizeLoaderSettings[ 'returnFocus' ].focus();
41                },
42 
43                closed: function() {
44Index: wp-admin/js/customize-controls.js
45===================================================================
46--- wp-admin/js/customize-controls.js   (revision 22724)
47+++ wp-admin/js/customize-controls.js   (working copy)
48@@ -876,9 +876,8 @@
49                $('.back').keydown( function( event ) {
50                        if ( 9 === event.which ) // tab
51                                return;
52-                       var thisHref = $(this).attr('href');
53                        if ( 13 === event.which ) // enter
54-                               window.location = thisHref;
55+                               parent.send( 'close' );
56                        event.preventDefault();
57                });
58