diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 56c061f..ad74ecb 100644
|
|
|
|
| 1123 | 1123 | section.template = wp.template( 'customize-themes-details-view' ); |
| 1124 | 1124 | |
| 1125 | 1125 | // Bind global keyboard events. |
| 1126 | | $( 'body' ).on( 'keyup', function( event ) { |
| | 1126 | section.container.on( 'keydown', function( event ) { |
| 1127 | 1127 | if ( ! section.overlay.find( '.theme-wrap' ).is( ':visible' ) ) { |
| 1128 | 1128 | return; |
| 1129 | 1129 | } |
| … |
… |
|
| 1141 | 1141 | // Pressing the escape key fires a theme:collapse event |
| 1142 | 1142 | if ( 27 === event.keyCode ) { |
| 1143 | 1143 | section.closeDetails(); |
| | 1144 | event.stopPropagation(); // Prevent section from being collapsed. |
| 1144 | 1145 | } |
| 1145 | 1146 | }); |
| 1146 | 1147 | |
| … |
… |
|
| 2864 | 2865 | }); |
| 2865 | 2866 | } |
| 2866 | 2867 | |
| 2867 | | this.setting.bind( function ( value ) { |
| | 2868 | control.setting.bind( function ( value ) { |
| 2868 | 2869 | // bail if the update came from the control itself |
| 2869 | 2870 | if ( updating ) { |
| 2870 | 2871 | return; |
| … |
… |
|
| 2872 | 2873 | picker.val( value ); |
| 2873 | 2874 | picker.wpColorPicker( 'color', value ); |
| 2874 | 2875 | } ); |
| | 2876 | |
| | 2877 | // Collapse color picker when hitting Esc instead of collapsing the current section. |
| | 2878 | control.container.on( 'keydown', function( event ) { |
| | 2879 | var pickerContainer; |
| | 2880 | if ( 27 !== event.which ) { // Esc. |
| | 2881 | return; |
| | 2882 | } |
| | 2883 | pickerContainer = control.container.find( '.wp-picker-container' ); |
| | 2884 | if ( pickerContainer.hasClass( 'wp-picker-active' ) ) { |
| | 2885 | picker.wpColorPicker( 'close' ); |
| | 2886 | control.container.find( '.wp-color-result' ).focus(); |
| | 2887 | event.stopPropagation(); // Prevent section from being collapsed. |
| | 2888 | } |
| | 2889 | } ); |
| 2875 | 2890 | } |
| 2876 | 2891 | }); |
| 2877 | 2892 | |
| … |
… |
|
| 5291 | 5306 | return; |
| 5292 | 5307 | } |
| 5293 | 5308 | |
| | 5309 | /* |
| | 5310 | * Abort if the event target is not the body (the default) and not inside of #customize-controls. |
| | 5311 | * This ensures that ESC meant to collapse a modal dialog or a TinyMCE toolbar won't collapse something else. |
| | 5312 | */ |
| | 5313 | if ( ! $( event.target ).is( 'body' ) && ! $.contains( $( '#customize-controls' )[0], event.target ) ) { |
| | 5314 | return; |
| | 5315 | } |
| | 5316 | |
| 5294 | 5317 | // Check for expanded expandable controls (e.g. widgets and nav menus items), sections, and panels. |
| 5295 | 5318 | api.control.each( function( control ) { |
| 5296 | 5319 | if ( control.expanded && control.expanded() && _.isFunction( control.collapse ) ) { |