Make WordPress Core

Changeset 38492


Ignore:
Timestamp:
09/01/2016 05:54:32 AM (10 years ago)
Author:
westonruter
Message:

Customize: Introduce paneVisible state and ensure pane is visible when a construct is expanded (or focused).

Fixes issue whereby a user would see nothing happen if the pane is collapsed while they shift-click to edit an element in the preview.

Props curdin, celloexpressions, westonruter.
See #27403.
Fixes #36678.

File:
1 edited

Legend:

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

    r38464 r38492  
    126126                        params.completeCallback = focus;
    127127                }
     128
     129                api.state( 'paneVisible' ).set( true );
    128130                if ( construct.expand ) {
    129131                        construct.expand( params );
    … …  
    442444                        }
    443445
     446                        api.state( 'paneVisible' ).set( true );
    444447                        params.completeCallback = function() {
    445448                                if ( previousCompleteCallback ) {
    … …  
    39133916                                saved = state.create( 'saved' ),
    39143917                                activated = state.create( 'activated' ),
    3915                                 processing = state.create( 'processing' );
     3918                                processing = state.create( 'processing' ),
     3919                                paneVisible = state.create( 'paneVisible' );
    39163920
    39173921                        state.bind( 'change', function() {
    … …  
    39343938                        activated( api.settings.theme.active );
    39353939                        processing( 0 );
     3940                        paneVisible( true );
    39363941
    39373942                        api.bind( 'change', function() {
    … …  
    39753980
    39763981                $( '.collapse-sidebar' ).on( 'click', function() {
    3977                         if ( 'true' === $( this ).attr( 'aria-expanded' ) ) {
    3978                                 $( this ).attr({ 'aria-expanded': 'false', 'aria-label': api.l10n.expandSidebar });
     3982                        api.state( 'paneVisible' ).set( ! api.state( 'paneVisible' ).get() );
     3983                });
     3984
     3985                api.state( 'paneVisible' ).bind( function( paneVisible ) {
     3986                        overlay.toggleClass( 'expanded', paneVisible );
     3987                        overlay.toggleClass( 'collapsed', ! paneVisible );
     3988
     3989                        if ( ! paneVisible ) {
     3990                                $( '.collapse-sidebar' ).attr({ 'aria-expanded': 'false', 'aria-label': api.l10n.expandSidebar });
    39793991                        } else {
    3980                                 $( this ).attr({ 'aria-expanded': 'true', 'aria-label': api.l10n.collapseSidebar });
    3981                         }
    3982 
    3983                         overlay.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
     3992                                $( '.collapse-sidebar' ).attr({ 'aria-expanded': 'true', 'aria-label': api.l10n.collapseSidebar });
     3993                        }
    39843994                });
    39853995
Note: See TracChangeset for help on using the changeset viewer.