diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 39f1b4fcdb..811d3ab856 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -5207,7 +5207,7 @@ expandedPanel( false ); expandedSection( false ); previewerAlive( true ); - editShortcutVisibility( 'initial' ); + editShortcutVisibility( 'visible' ); api.bind( 'change', function() { state('saved').set( false ); @@ -5813,6 +5813,21 @@ }); // Update the edit shortcut visibility state. + api.state( 'paneVisible' ).bind( function( isPaneVisible ) { + var isMobileScreen; + if ( window.matchMedia ) { + isMobileScreen = window.matchMedia( 'screen and ( max-width: 640px )' ).matches; + } else { + isMobileScreen = $( window ).width() <= 640; + } + api.state( 'editShortcutVisibility' ).set( isPaneVisible || isMobileScreen ? 'visible' : 'hidden' ); + } ); + if ( window.matchMedia ) { + window.matchMedia( 'screen and ( max-width: 640px )' ).addListener( function() { + var state = api.state( 'paneVisible' ); + state.callbacks.fireWith( state, [ state.get(), state.get() ] ); + } ); + } api.previewer.bind( 'edit-shortcut-visibility', function( visibility ) { api.state( 'editShortcutVisibility' ).set( visibility ); } ); diff --git a/src/wp-includes/css/customize-preview.css b/src/wp-includes/css/customize-preview.css index a388488769..fee3b7bf1d 100644 --- a/src/wp-includes/css/customize-preview.css +++ b/src/wp-includes/css/customize-preview.css @@ -80,13 +80,6 @@ body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut:be pointer-events: none; } -body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:before { - animation-duration: 1.5s; - animation-delay: 0.4s; - animation-name: customize-partial-edit-shortcut-bounce-disappear; - pointer-events: none; -} - .page-sidebar-collapsed .customize-partial-edit-shortcut:before, .customize-partial-edit-shortcut-hidden:before { visibility: hidden; diff --git a/src/wp-includes/js/customize-selective-refresh.js b/src/wp-includes/js/customize-selective-refresh.js index 0fc06e92c9..bfbb2ef2fa 100644 --- a/src/wp-includes/js/customize-selective-refresh.js +++ b/src/wp-includes/js/customize-selective-refresh.js @@ -996,7 +996,6 @@ wp.customize.selectiveRefresh = ( function( $, api ) { shouldAnimateHide = ( 'hidden' === visibility && body.hasClass( 'customize-partial-edit-shortcuts-shown' ) && ! body.hasClass( 'customize-partial-edit-shortcuts-hidden' ) ); body.toggleClass( 'customize-partial-edit-shortcuts-hidden', shouldAnimateHide ); body.toggleClass( 'customize-partial-edit-shortcuts-shown', 'visible' === visibility ); - body.toggleClass( 'customize-partial-edit-shortcuts-flash', 'initial' === visibility ); } ); api.preview.bind( 'active', function() { @@ -1022,14 +1021,6 @@ wp.customize.selectiveRefresh = ( function( $, api ) { self.partial.bind( 'add', function( partial ) { partial.deferred.ready.resolve(); } ); - - body.on( 'click', function( event ) { - if ( event.shiftKey || $( event.target ).is( '.customize-partial-edit-shortcut, :input, button *, a[href], a[href] *, object, object *, [tabindex], [tabindex] *' ) ) { - return; // Don't toggle shortcuts on shift-clicks or clicks on (or in) interactive elements. - } - api.selectiveRefresh.editShortcutVisibility.set( 'visible' === api.selectiveRefresh.editShortcutVisibility.get() ? 'hidden' : 'visible' ); - api.preview.send( 'edit-shortcut-visibility', api.selectiveRefresh.editShortcutVisibility.get() ); - } ); } ); } );