Changeset 33511
- Timestamp:
- 07/29/2015 11:39:54 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-nav-menus.css
r33510 r33511 591 591 left: -301px; 592 592 visibility: hidden; 593 overflow: hidden; 593 overflow-x: hidden; 594 overflow-y: auto; 594 595 width: 300px; 595 596 margin: 0; … … 601 602 } 602 603 603 #available-menu-items.allow-scroll { 604 overflow-y: auto; 604 #available-menu-items.opening { 605 overflow-y: hidden; /* avoid scrollbar jitter with animating heights */ 606 } 607 608 #available-menu-items #available-menu-items-search.open { 609 height: 100%; 610 border-bottom: none; 605 611 } 606 612 … … 611 617 } 612 618 613 #available-menu-items .open .accordion-section-title { 619 #available-menu-items .open .accordion-section-title, 620 #available-menu-items #available-menu-items-search .accordion-section-title { 614 621 background: #eee; 615 622 } … … 703 710 } 704 711 712 #available-menu-items #available-menu-items-search .accordion-section-content { 713 position: absolute; 714 left: 1px; 715 top: 60px; /* below title div / search input */ 716 bottom: 0px; /* 100% height that still triggers lazy load */ 717 max-height: none; 718 width: 270px; 719 } 720 705 721 #available-menu-items .menu-item-tpl { 706 722 margin: 0; … … 801 817 visibility: visible; 802 818 margin: 0 20px; 819 } 820 821 #available-menu-items-search .clear-results { 822 position: absolute; 823 top: 20px; 824 right: 20px; 825 width: 20px; 826 height: 20px; 827 cursor: pointer; 828 color: #a00; 829 text-decoration: none; 830 } 831 832 #available-menu-items-search .clear-results, 833 #available-menu-items-search.loading .clear-results.is-visible { 834 display: none; 835 } 836 837 #available-menu-items-search .clear-results.is-visible { 838 display: block; 839 } 840 841 #available-menu-items-search .clear-results:before { 842 content: "\f335"; 843 font: normal 20px/1 dashicons; 844 -webkit-font-smoothing: antialiased; 845 -moz-osx-font-smoothing: grayscale; 846 } 847 848 #available-menu-items-search .clear-results:hover, 849 #available-menu-items-search .clear-results:focus { 850 color: #f00; 851 } 852 853 #available-menu-items-search .clear-results:focus { 854 -webkit-box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); 855 box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8); 803 856 } 804 857 -
trunk/src/wp-admin/js/accordion.js
r33413 r33511 55 55 var section = el.closest( '.accordion-section' ), 56 56 sectionToggleControl = section.find( '[aria-expanded]' ).first(), 57 siblings = section.closest( '.accordion-container' ).find( '.open' ), 57 container = section.closest( '.accordion-container' ), 58 siblings = container.find( '.open' ), 58 59 siblingsToggleControl = siblings.find( '[aria-expanded]' ).first(), 59 60 content = section.find( '.accordion-section-content' ); … … 63 64 return; 64 65 } 66 67 // Add a class to the container to let us know something is happening inside. 68 // This helps in cases such as hiding a scrollbar while animations are executing. 69 container.addClass( 'opening' ); 65 70 66 71 if ( section.hasClass( 'open' ) ) { … … 75 80 } 76 81 82 // We have to wait for the animations to finish 83 setTimeout(function(){ 84 container.removeClass( 'opening' ); 85 }, 150); 86 77 87 // If there's an element with an aria-expanded attribute, assume it's a toggle control and toggle the aria-expanded value. 78 88 if ( sectionToggleControl ) { -
trunk/src/wp-admin/js/customize-nav-menus.js
r33496 r33511 97 97 'input #menu-items-search': 'debounceSearch', 98 98 'keyup #menu-items-search': 'debounceSearch', 99 'click #menu-items-search': 'debounceSearch',100 99 'focus .menu-item-tpl': 'focus', 101 100 'click .menu-item-tpl': '_submit', … … 139 138 } ); 140 139 140 // Clear the search results. 141 $( '.clear-results' ).on( 'click keydown', function( event ) { 142 console.log(event); 143 if ( event.type === 'keydown' && ( 13 !== event.which && 32 !== event.which ) ) { // "return" or "space" keys only 144 return; 145 } 146 147 event.preventDefault(); 148 149 $( '#menu-items-search' ).val( '' ).focus(); 150 event.target.value = ''; 151 self.search( event ); 152 } ); 153 141 154 this.$el.on( 'input', '#custom-menu-item-name.invalid, #custom-menu-item-url.invalid', function() { 142 155 $( this ).removeClass( 'invalid' ); … … 177 190 search: function( event ) { 178 191 var $searchSection = $( '#available-menu-items-search' ), 179 $o penSections = $( '#available-menu-items .accordion-section.open');192 $otherSections = $( '#available-menu-items .accordion-section' ).not( $searchSection ); 180 193 181 194 if ( ! event ) { 182 195 return; 183 196 } 184 // Manual accordion-opening behavior. 185 if ( this.searchTerm && ! $searchSection.hasClass( 'open' ) ) { 186 $openSections.find( '.accordion-section-content' ).slideUp( 'fast' ); 187 $searchSection.find( '.accordion-section-content' ).slideDown( 'fast' ); 188 $openSections.find( '[aria-expanded]' ).first().attr( 'aria-expanded', 'false' ); 189 $openSections.removeClass( 'open' ); 190 $searchSection.addClass( 'open' ); 191 } 192 if ( '' === event.target.value ) { 193 $searchSection.removeClass( 'open' ); 194 } 197 195 198 if ( this.searchTerm === event.target.value ) { 196 199 return; 197 200 } 201 202 if ( '' !== event.target.value && ! $searchSection.hasClass( 'open' ) ) { 203 $otherSections.fadeOut( 100 ); 204 $searchSection.find( '.accordion-section-content' ).slideDown( 'fast' ); 205 $searchSection.addClass( 'open' ); 206 $searchSection.find( '.clear-results' ) 207 .prop( 'tabIndex', 0 ) 208 .addClass( 'is-visible' ); 209 } else if ( '' === event.target.value ) { 210 $searchSection.removeClass( 'open' ); 211 $otherSections.show(); 212 $searchSection.find( '.clear-results' ) 213 .prop( 'tabIndex', -1 ) 214 .removeClass( 'is-visible' ); 215 } 216 198 217 this.searchTerm = event.target.value; 199 218 this.pages.search = 1; … … 352 371 if ( 120 < diff && 290 > diff ) { 353 372 sections.css( 'max-height', diff ); 354 } else if ( 120 >= diff ) {355 this.$el.addClass( 'allow-scroll' );356 373 } 357 374 }, -
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r33493 r33511 218 218 219 219 if ( empty( $items ) ) { 220 wp_send_json_error( array( 'message' => __( 'No menu items found.' ) ) );220 wp_send_json_error( array( 'message' => __( 'No results found.' ) ) ); 221 221 } else { 222 222 wp_send_json_success( array( 'items' => $items ) ); … … 719 719 <p class="screen-reader-text" id="menu-items-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p> 720 720 <span class="spinner"></span> 721 <span class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></span> 721 722 </div> 722 723 <ul class="accordion-section-content" data-type="search"></ul> -
trunk/tests/phpunit/tests/ajax/CustomizeMenus.php
r33366 r33511 521 521 'success' => false, 522 522 'data' => array( 523 'message' => 'No menu items found.',523 'message' => 'No results found.', 524 524 ), 525 525 ),
Note: See TracChangeset
for help on using the changeset viewer.