Changeset 39120
- Timestamp:
- 11/03/2016 06:18:35 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/customize-controls.js
r39112 r39120 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; … … 1142 1142 if ( 27 === event.keyCode ) { 1143 1143 section.closeDetails(); 1144 event.stopPropagation(); // Prevent section from being collapsed. 1144 1145 } 1145 1146 }); … … 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 ) { … … 2872 2873 picker.val( value ); 2873 2874 picker.wpColorPicker( 'color', value ); 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 } 2874 2889 } ); 2875 2890 } … … 5302 5317 } 5303 5318 5319 /* 5320 * Abort if the event target is not the body (the default) and not inside of #customize-controls. 5321 * This ensures that ESC meant to collapse a modal dialog or a TinyMCE toolbar won't collapse something else. 5322 */ 5323 if ( ! $( event.target ).is( 'body' ) && ! $.contains( $( '#customize-controls' )[0], event.target ) ) { 5324 return; 5325 } 5326 5304 5327 // Check for expanded expandable controls (e.g. widgets and nav menus items), sections, and panels. 5305 5328 api.control.each( function( control ) {
Note: See TracChangeset
for help on using the changeset viewer.