diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
index 7078cfd..6891acc 100644
|
|
|
808 | 808 | section.template = wp.template( 'customize-themes-details-view' ); |
809 | 809 | |
810 | 810 | // Bind global keyboard events. |
811 | | $( 'body' ).on( 'keyup', function( event ) { |
| 811 | section.container.on( 'keydown', function( event ) { |
812 | 812 | if ( ! section.overlay.find( '.theme-wrap' ).is( ':visible' ) ) { |
813 | 813 | return; |
814 | 814 | } |
… |
… |
|
826 | 826 | // Pressing the escape key fires a theme:collapse event |
827 | 827 | if ( 27 === event.keyCode ) { |
828 | 828 | section.closeDetails(); |
| 829 | event.stopPropagation(); // Prevent section from being collapsed. |
829 | 830 | } |
830 | 831 | }); |
831 | 832 | |
… |
… |
|
1890 | 1891 | picker.val( value ); |
1891 | 1892 | picker.wpColorPicker( 'color', value ); |
1892 | 1893 | }); |
| 1894 | |
| 1895 | control.container.on( 'keydown', function( event ) { |
| 1896 | var pickerContainer; |
| 1897 | if ( 27 !== event.which ) { // Esc. |
| 1898 | return; |
| 1899 | } |
| 1900 | pickerContainer = control.container.find( '.wp-picker-container' ); |
| 1901 | if ( pickerContainer.hasClass( 'wp-picker-active' ) ) { |
| 1902 | picker.wpColorPicker( 'close' ); |
| 1903 | control.container.find( '.wp-color-result' ).focus(); |
| 1904 | event.stopPropagation(); // Prevent section from being collapsed. |
| 1905 | } |
| 1906 | } ); |
1893 | 1907 | } |
1894 | 1908 | }); |
1895 | 1909 | |
… |
… |
|
4002 | 4016 | return; |
4003 | 4017 | } |
4004 | 4018 | |
| 4019 | /* |
| 4020 | * Abort if the event target is not the body (the default) and not inside of #customize-controls. |
| 4021 | * This ensures that ESC meant to collapse a modal dialog or a TinyMCE toolbar won't collapse something else. |
| 4022 | */ |
| 4023 | if ( ! $( event.target ).is( 'body' ) && ! $.contains( $( '#customize-controls' )[0], event.target ) ) { |
| 4024 | return; |
| 4025 | } |
| 4026 | |
4005 | 4027 | // Check for expanded expandable controls (e.g. widgets and nav menus items), sections, and panels. |
4006 | 4028 | api.control.each( function( control ) { |
4007 | 4029 | if ( control.expanded && control.expanded() && _.isFunction( control.collapse ) ) { |