Make WordPress Core

Changeset 22756


Ignore:
Timestamp:
11/21/2012 01:17:10 PM (12 years ago)
Author:
koopersmith
Message:

Customizer: Track the link that was used to open the customizer and restore focus on close. props lessbloat. fixes #21283.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/customize-controls.js

    r22731 r22756  
    882882            if ( 9 === event.which ) // tab
    883883                return;
    884             var thisHref = $(this).attr('href');
    885884            if ( 13 === event.which ) // enter
    886                 window.location = thisHref;
     885                parent.send( 'close' );
    887886            event.preventDefault();
    888887        });
  • trunk/wp-includes/js/customize-loader.js

    r22126 r22756  
    2929                event.preventDefault();
    3030
     31                // Store a reference to the link that opened the customizer.
     32                Loader.link = $(this);
    3133                // Load the theme.
    32                 Loader.open( $(this).attr('href') );
     34                Loader.open( Loader.link.attr('href') );
    3335            });
    3436
     
    124126
    125127            this.trigger( 'close' );
     128
     129            // Return focus to link that was originally clicked.
     130            if ( this.link )
     131                this.link.focus();
    126132        },
    127133
Note: See TracChangeset for help on using the changeset viewer.