Make WordPress Core

Ticket #36903: 36903.3.patch

File 36903.3.patch, 4.6 KB (added by afercia, 9 years ago)
  • src/wp-admin/css/customize-nav-menus.css

     
    607607
    608608#available-menu-items-search .clear-results {
    609609        position: absolute;
    610         top: 20px;
     610        top: 18px; /* 12 container padding +1 input margin +1 input border +4 ( 4 is ( 28 input height - 20 button height ) / 2 ) */
    611611        right: 20px;
    612612        width: 20px;
    613613        height: 20px;
     614        padding: 0;
     615        border: 0;
    614616        cursor: pointer;
     617        background: none;
    615618        color: #a00;
    616619        text-decoration: none;
     620        outline: 0;
    617621}
    618622
    619623#available-menu-items-search .clear-results,
     
    625629        display: block;
    626630}
    627631
     632.ie8 #available-menu-items-search.loading .clear-results:before {
     633        content: ""; /* help IE8 redraw the pseudo element */
     634}
     635
    628636#available-menu-items-search .clear-results:before {
    629637        content: "\f335";
    630638        font: normal 20px/1 dashicons;
     639        vertical-align: middle;
    631640        -webkit-font-smoothing: antialiased;
    632641        -moz-osx-font-smoothing: grayscale;
    633642}
     
    639648
    640649#available-menu-items-search .spinner {
    641650        position: absolute;
    642         top: 20px;
     651        top: 18px; /* 12 container padding +1 input margin +1 input border +4 ( ( 28 input height - 20 button height ) / 2 ) */
     652        right: 20px;
    643653        margin: 0 !important;
    644         right: 20px;
    645654}
    646655
    647656/* search results list */
     
    840849        #available-menu-items #available-menu-items-search .accordion-section-content {
    841850                top: 63px;
    842851        }
     852
     853        #available-menu-items-search .spinner,
     854        #available-menu-items-search .clear-results {
     855                top: 20px; /* 12 container padding +1 input margin +1 input border +5.5 ( 5.5 rounded to 6 is ( 31 input height - 20 button height ) / 2 ) */
     856        }
    843857}
    844858
    845859@media screen and ( max-width: 640px ) {
     
    846860        #available-menu-items #available-menu-items-search .accordion-section-content {
    847861                top: 133px;
    848862        }
     863
     864        #available-menu-items-search .clear-results {
     865                top: 90px; /* 70 section title height + 12 container padding +1 input margin +1 input border +5.5 ( 5.5 rounded to 6 is ( 31 input height - 20 button height ) / 2 ) */
     866        }
    849867}
  • src/wp-admin/js/customize-nav-menus.js

     
    142142                        } );
    143143
    144144                        // Clear the search results.
    145                         $( '.clear-results' ).on( 'click keydown', function( event ) {
    146                                 if ( event.type === 'keydown' && ( 13 !== event.which && 32 !== event.which ) ) { // "return" or "space" keys only
    147                                         return;
    148                                 }
    149 
    150                                 event.preventDefault();
    151 
    152                                 $( '#menu-items-search' ).val( '' ).focus();
    153                                 event.target.value = '';
    154                                 self.search( event );
     145                        $( '.clear-results' ).on( 'click', function() {
     146                                self.$search.val( '' ).focus().trigger( 'keyup' );
    155147                        } );
    156148
    157149                        this.$el.on( 'input', '#custom-menu-item-name.invalid, #custom-menu-item-url.invalid', function() {
     
    208200                                $otherSections.fadeOut( 100 );
    209201                                $searchSection.find( '.accordion-section-content' ).slideDown( 'fast' );
    210202                                $searchSection.addClass( 'open' );
    211                                 $searchSection.find( '.clear-results' )
    212                                         .prop( 'tabIndex', 0 )
    213                                         .addClass( 'is-visible' );
     203                                $searchSection.find( '.clear-results' ).addClass( 'is-visible' );
    214204                        } else if ( '' === event.target.value ) {
    215205                                $searchSection.removeClass( 'open' );
    216206                                $otherSections.show();
    217                                 $searchSection.find( '.clear-results' )
    218                                         .prop( 'tabIndex', -1 )
    219                                         .removeClass( 'is-visible' );
     207                                $searchSection.find( '.clear-results' ).removeClass( 'is-visible' );
    220208                        }
    221209
    222210                        this.searchTerm = event.target.value;
  • src/wp-includes/class-wp-customize-nav-menus.php

     
    761761                                        <input type="text" id="menu-items-search" placeholder="<?php esc_attr_e( 'Search menu items&hellip;' ) ?>" aria-describedby="menu-items-search-desc" />
    762762                                        <p class="screen-reader-text" id="menu-items-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p>
    763763                                        <span class="spinner"></span>
    764                                         <span class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></span>
    765764                                </div>
     765                                <button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button>
    766766                                <ul class="accordion-section-content" data-type="search"></ul>
    767767                        </div>
    768768                        <div id="new-custom-menu-item" class="accordion-section">