Make WordPress Core

Ticket #31575: 31575.2.patch

File 31575.2.patch, 6.2 KB (added by afercia, 11 years ago)
  • src/wp-admin/css/press-this.css

     
    854854
    855855.add-cat-toggle {
    856856        float: right;
    857         margin-top: -33px;
     857        margin-top: -45px;
     858        line-height: 20px;
     859        padding: 12px 10px 8px;
    858860}
    859861
     862.add-cat-toggle.is-toggled {
     863          padding: 10px;
     864}
     865
    860866.add-cat-toggle:focus {
    861867        text-decoration: none;
    862868        color: #2ea2cc;
    863869}
    864870
    865 .add-cat-toggle.is-toggled {
    866         margin-top: -36px;
    867 }
    868 
    869871.add-cat-toggle.is-toggled .dashicons:before {
    870872        content: "\f179";
    871873}
     
    11851187        vertical-align: middle;
    11861188}
    11871189
    1188 .options-open,
    1189 .options-close {
     1190.options-toggle {
    11901191        display: none;
    11911192}
    11921193
    11931194@media (max-width: 900px) {
    1194         .options-open,
    1195         .options-close {
     1195        .options-toggle {
    11961196                display: block;
    11971197        }
    11981198}
    11991199
    1200 .options-open.is-hidden,
    1201 .options-close.is-hidden,
     1200.options-open-label.is-hidden,
     1201.options-close-label.is-hidden,
    12021202.options-panel-back.is-hidden {
    12031203        display: none;
    12041204}
    12051205
    1206 .options-open:focus .dashicons {
     1206.options-toggle:hover .dashicons,
     1207.options-toggle:focus .dashicons {
    12071208        color: #fff;
    12081209        text-decoration: none;
    12091210}
    12101211
    1211 .options-open .dashicons {
     1212.options-toggle .dashicons {
    12121213        margin-top: 3px;
    12131214}
    12141215
    1215 .options-close {
     1216.options-close-label {
    12161217        color: #2ea2cc;
    12171218}
    12181219
  • src/wp-admin/includes/class-wp-press-this.php

     
    12011201                                <span class="current-site-name"><?php bloginfo( 'name' ); ?></span>
    12021202                        </a>
    12031203                </h1>
    1204                 <button type="button" class="options-open button-subtle">
    1205                         <span class="dashicons dashicons-tag"></span><span class="screen-reader-text"><?php _e( 'Show post options' ); ?></span>
     1204                <button type="button" class="options-toggle button-subtle" aria-expanded="false" aria-controls="options-panel">
     1205                        <span class="options-open-label"><span class="dashicons dashicons-tag"></span><span class="screen-reader-text"><?php _e( 'Show post options' ); ?></span></span>
     1206                        <span class="options-close-label is-hidden"><span aria-hidden="true"><?php _e( 'Done' ); ?></span><span class="screen-reader-text"><?php _e( 'Close post options' ); ?></span></span>
    12061207                </button>
    1207                 <button type="button" class="options-close button-subtle is-hidden"><?php _e( 'Done' ); ?></button>
    12081208        </div>
    12091209
    12101210        <div id="scanbar" class="scan">
     
    12731273                </div>
    12741274
    12751275                <div class="options-panel-back is-hidden" tabindex="-1"></div>
    1276                 <div class="options-panel is-off-screen is-hidden" tabindex="-1">
     1276                <div class="options-panel is-off-screen is-hidden" tabindex="-1" id="options-panel">
    12771277                        <div class="post-options">
    12781278
    12791279                                <?php if ( $supports_formats ) : ?>
  • src/wp-admin/js/press-this.js

     
    470470
    471471                /**
    472472                 * Interactive behavior for the sidebar toggle, to show the options modals
     473                 *
     474                 * @param action string Optional toggle|close (defaults to toggle)
    473475                 */
    474                 function openSidebar() {
    475                         sidebarIsOpen = true;
     476                function toggleSidebar( event, action ) {
    476477
    477                         $( '.options-open, .press-this-actions, #scanbar' ).addClass( isHidden );
    478                         $( '.options-close, .options-panel-back' ).removeClass( isHidden );
     478                        if ( ! action ) {
     479                                action = 'toggle';
     480                        }
    479481
    480                         $( '.options-panel' ).removeClass( offscreenHidden )
    481                                 .one( 'transitionend', function() {
    482                                         $( '.post-option:first' ).focus();
    483                                 } );
    484                 }
     482                        if ( ! sidebarIsOpen ) {
     483                                sidebarIsOpen = true;
    485484
    486                 function closeSidebar() {
    487                         sidebarIsOpen = false;
     485                                $( '.options-toggle' ).attr( 'aria-expanded', 'true' );
     486                                $( '.options-open-label, .press-this-actions, #scanbar' ).addClass( isHidden );
     487                                $( '.options-close-label, .options-panel-back' ).removeClass( isHidden );
    488488
    489                         $( '.options-close, .options-panel-back' ).addClass( isHidden );
    490                         $( '.options-open, .press-this-actions, #scanbar' ).removeClass( isHidden );
     489                                $( '.options-panel' ).removeClass( offscreenHidden )
     490                                        .one( 'transitionend', function() {
     491                                                $( '.post-option:first' ).focus();
     492                                        } );
     493                                return;
     494                        }
    491495
    492                         $( '.options-panel' ).addClass( isOffScreen )
    493                                 .one( 'transitionend', function() {
    494                                         $( this ).addClass( isHidden );
    495                                         // Reset to options list
    496                                         $( '.post-options' ).removeClass( offscreenHidden );
    497                                         $( '.setting-modal').addClass( offscreenHidden );
    498                                 });
     496                        if ( 'close' === action || sidebarIsOpen ) {
     497                                sidebarIsOpen = false;
     498
     499                                $( '.options-toggle' ).attr( 'aria-expanded', 'false' );
     500                                $( '.options-close-label, .options-panel-back' ).addClass( isHidden );
     501                                $( '.options-open-label, .press-this-actions, #scanbar' ).removeClass( isHidden );
     502
     503                                $( '.options-panel' ).addClass( isOffScreen )
     504                                        .one( 'transitionend', function() {
     505                                                $( this ).addClass( isHidden );
     506                                                // Reset to options list
     507                                                $( '.post-options' ).removeClass( offscreenHidden );
     508                                                $( '.setting-modal').addClass( offscreenHidden );
     509                                        } );
     510                                return;
     511                        }
    499512                }
    500513
    501514                /**
     
    598611                        monitorPlaceholder();
    599612                        monitorCatList();
    600613
    601                         $( '.options-open' ).on( 'click.press-this', openSidebar );
    602                         $( '.options-close' ).on( 'click.press-this', closeSidebar );
     614                        $( '.options-toggle' ).on( 'click.press-this', toggleSidebar );
    603615
    604616                        // Close the sidebar when focus moves outside of it.
    605                         $( '.options-panel, .options-panel-back' ).on( 'focusout.press-this', function() {
     617                        $( '.options-panel, .options-panel-back' ).on( 'focusout.press-this', function( event ) {
    606618                                setTimeout( function() {
    607619                                        var node = document.activeElement,
    608620                                                $node = $( node );
     
    610622                                        if ( sidebarIsOpen && node && ! $node.hasClass( 'options-panel-back' ) &&
    611623                                                ( node.nodeName === 'BODY' ||
    612624                                                        ( ! $node.closest( '.options-panel' ).length &&
    613                                                         ! $node.closest( '.options-open' ).length ) ) ) {
     625                                                        ! $node.closest( '.options-toggle' ).length ) ) ) {
    614626
    615                                                 closeSidebar();
     627                                                toggleSidebar( event, 'close' );
    616628                                        }
    617629                                }, 50 );
    618630                        });