Changeset 38709
- Timestamp:
- 10/03/2016 04:27:55 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r38672 r38709 1410 1410 bottom: 0; 1411 1411 width: 100%; 1412 border-top: 1px solid #ddd; 1413 } 1414 1415 .no-widgets-found #available-widgets-list { 1416 border-top: none; 1412 1417 } 1413 1418 … … 1418 1423 width: 300px; 1419 1424 background: #eee; 1420 border-bottom: 1px solid #e5e5e5;1421 1425 } 1422 1426 … … 1424 1428 #available-widgets-filter, 1425 1429 #available-menu-items-search .accordion-section-title { 1426 padding: 1 2px 15px;1430 padding: 13px 15px; 1427 1431 -webkit-box-sizing: border-box; 1428 1432 -moz-box-sizing: border-box; … … 1432 1436 #available-widgets-filter input, 1433 1437 #available-menu-items-search input { 1434 padding: 6px 10px; 1435 width: 100%; 1438 width: 100%; 1439 height: 32px; 1440 margin: 1px 0; 1441 padding: 6px 30px; 1442 } 1443 1444 #available-widgets-filter input::-ms-clear, 1445 #available-menu-items-search input::-ms-clear { 1446 display: none; /* remove the "x" in IE, which conflicts with the "x" icon on button.clear-results */ 1447 } 1448 1449 #available-menu-items-search .search-icon, 1450 #available-widgets-filter .search-icon { 1451 display: block; 1452 position: absolute; 1453 top: 15px; /* 13 container padding +1 input margin +1 input border */ 1454 left: 16px; 1455 width: 30px; 1456 height: 30px; 1457 line-height: 28px; 1458 text-align: center; 1459 color: #72777c; 1460 } 1461 1462 #available-widgets-filter .clear-results, 1463 #available-menu-items-search .clear-results { 1464 position: absolute; 1465 top: 15px; /* 13 container padding +1 input margin +1 input border */ 1466 right: 16px; 1467 width: 30px; 1468 height: 30px; 1469 padding: 0; 1470 border: 0; 1471 cursor: pointer; 1472 background: none; 1473 color: #a00; 1474 text-decoration: none; 1475 outline: 0; 1476 } 1477 1478 #available-widgets-filter .clear-results, 1479 #available-menu-items-search .clear-results, 1480 #available-menu-items-search.loading .clear-results.is-visible { 1481 display: none; 1482 } 1483 1484 #available-widgets-filter .clear-results.is-visible, 1485 #available-menu-items-search .clear-results.is-visible { 1486 display: block; 1487 } 1488 1489 #available-widgets-filter .clear-results:before, 1490 #available-menu-items-search .clear-results:before { 1491 content: "\f335"; 1492 font: normal 20px/1 dashicons; 1493 vertical-align: middle; 1494 -webkit-font-smoothing: antialiased; 1495 -moz-osx-font-smoothing: grayscale; 1496 } 1497 1498 #available-widgets-filter .clear-results:hover, 1499 #available-widgets-filter .clear-results:focus, 1500 #available-menu-items-search .clear-results:hover, 1501 #available-menu-items-search .clear-results:focus { 1502 color: #dc3232; 1503 } 1504 1505 #available-widgets-filter .clear-results:focus, 1506 #available-menu-items-search .clear-results:focus { 1507 -webkit-box-shadow: 1508 0 0 0 1px #5b9dd9, 1509 0 0 2px 1px rgba(30, 140, 190, .8); 1510 box-shadow: 1511 0 0 0 1px #5b9dd9, 1512 0 0 2px 1px rgba(30, 140, 190, .8); 1513 } 1514 1515 #available-menu-items-search .search-icon:after, 1516 #available-widgets-filter .search-icon:after { 1517 content: "\f179"; 1518 font: normal 20px/1 dashicons; 1519 vertical-align: middle; 1520 -webkit-font-smoothing: antialiased; 1521 -moz-osx-font-smoothing: grayscale; 1522 } 1523 1524 .no-widgets-found-message { 1525 display: none; 1526 margin: 0; 1527 padding: 0 15px; 1528 line-height: inherit; 1529 } 1530 1531 .no-widgets-found .no-widgets-found-message { 1532 display: block; 1436 1533 } 1437 1534 … … 1451 1548 padding: 20px 15px 20px 60px; 1452 1549 background: #fff; 1453 border-bottom: 1px solid # e5e5e5;1550 border-bottom: 1px solid #ddd; 1454 1551 border-left: 4px solid #fff; 1455 1552 cursor: pointer; … … 1629 1726 position: relative; 1630 1727 width: 100%; 1631 background: #fff;1632 1728 height: auto; 1633 padding: 10px 15px;1634 1729 } 1635 1730 1636 1731 #available-widgets-list { 1637 top: 140px; 1638 } 1639 } 1732 top: 130px; 1733 } 1734 1735 #available-menu-items-search .clear-results, 1736 #available-menu-items-search .search-icon { 1737 top: 85px; /* 70 section title height + 13 container padding +1 input margin +1 input border */ 1738 } 1739 } -
trunk/src/wp-admin/css/customize-nav-menus.css
r38688 r38709 689 689 } 690 690 691 #available-menu-items-search .clear-results {692 position: absolute;693 top: 18px; /* 12 container padding +1 input margin +1 input border +4 ( 4 is ( 28 input height - 20 button height ) / 2 ) */694 right: 20px;695 width: 20px;696 height: 20px;697 padding: 0;698 border: 0;699 cursor: pointer;700 background: none;701 color: #a00;702 text-decoration: none;703 outline: 0;704 }705 706 #available-menu-items-search .clear-results,707 #available-menu-items-search.loading .clear-results.is-visible {708 display: none;709 }710 711 #available-menu-items-search .clear-results.is-visible {712 display: block;713 }714 715 .ie8 #available-menu-items-search.loading .clear-results:before {716 content: ""; /* help IE8 redraw the pseudo element */717 }718 719 #available-menu-items-search .clear-results:before {720 content: "\f335";721 font: normal 20px/1 dashicons;722 vertical-align: middle;723 -webkit-font-smoothing: antialiased;724 -moz-osx-font-smoothing: grayscale;725 }726 727 #available-menu-items-search .clear-results:hover,728 #available-menu-items-search .clear-results:focus {729 color: #f00;730 }731 732 691 #available-menu-items-search .spinner { 733 692 position: absolute; 734 top: 18px; /* 12 container padding +1 input margin +1 input border +4 ( ( 28 input height - 20 buttonheight ) / 2 ) */735 right: 2 0px;693 top: 20px; /* 13 container padding +1 input margin +6 ( ( 32 input height - 20 spinner height ) / 2 ) */ 694 right: 21px; 736 695 margin: 0 !important; 737 696 } … … 740 699 #available-menu-items #available-menu-items-search .accordion-section-content { 741 700 position: absolute; 742 left: 1px;701 left: 0; 743 702 top: 60px; /* below title div / search input */ 744 703 bottom: 0px; /* 100% height that still triggers lazy load */ … … 751 710 } 752 711 712 #available-menu-items-search .nothing-found { 713 /* Compensate the 1px top padding of the container. */ 714 margin-top: -1px; 715 } 716 753 717 #available-menu-items-search .accordion-section-title:after { 754 718 display: none; … … 921 885 #customize-controls .customize-info .customize-help-toggle:focus:before, 922 886 .wp-customizer button:focus .toggle-indicator:after, 923 #available-menu-items-search .clear-results:focus,924 887 .menu-delete:focus, 925 888 .menu-item-bar .item-delete:focus:before, … … 938 901 top: 63px; 939 902 } 940 941 #available-menu-items-search .spinner,942 #available-menu-items-search .clear-results {943 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 ) */944 }945 903 } 946 904 947 905 @media screen and ( max-width: 640px ) { 948 906 #available-menu-items #available-menu-items-search .accordion-section-content { 949 top: 13 3px;907 top: 130px; 950 908 } 951 952 #available-menu-items-search .clear-results { 953 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 ) */ 954 } 955 } 909 } -
trunk/src/wp-admin/js/customize-nav-menus.js
r38668 r38709 171 171 debounceSearch: null, 172 172 $search: null, 173 $clearResults: null, 173 174 searchTerm: '', 174 175 rendered: false, … … 186 187 187 188 this.$search = $( '#menu-items-search' ); 189 this.$clearResults = this.$el.find( '.clear-results' ); 188 190 this.sectionContent = this.$el.find( '.available-menu-items-list' ); 189 191 … … 203 205 } ); 204 206 205 // Clear the search results .206 $( '.clear-results' ).on( 'click', function() {207 // Clear the search results and trigger a `keyup` event to fire a new search. 208 this.$clearResults.on( 'click', function() { 207 209 self.$search.val( '' ).focus().trigger( 'keyup' ); 208 210 } ); … … 262 264 $searchSection.find( '.accordion-section-content' ).slideDown( 'fast' ); 263 265 $searchSection.addClass( 'open' ); 264 $searchSection.find( '.clear-results' ).addClass( 'is-visible' );266 this.$clearResults.addClass( 'is-visible' ); 265 267 } else if ( '' === event.target.value ) { 266 268 $searchSection.removeClass( 'open' ); 267 269 $otherSections.show(); 268 $searchSection.find( '.clear-results' ).removeClass( 'is-visible' );270 this.$clearResults.removeClass( 'is-visible' ); 269 271 } 270 272 … … 338 340 // data.message may be undefined, for example when typing slow and the request is aborted. 339 341 if ( data.message ) { 340 $content.empty().append( $( '< p class="nothing-found"></p>' ).text( data.message ) );342 $content.empty().append( $( '<li class="nothing-found"></li>' ).text( data.message ) ); 341 343 wp.a11y.speak( data.message ); 342 344 } -
trunk/src/wp-admin/js/customize-widgets.js
r38672 r38709 71 71 } 72 72 73 // If search is blank, show all themes 74 // Useful for resetting the views when you clean the input 73 // If search is blank, set all the widgets as they matched the search to reset the views. 75 74 if ( this.terms === '' ) { 76 75 this.each( function ( widget ) { … … 150 149 'input #widgets-search': 'search', 151 150 'keyup #widgets-search': 'search', 152 'change #widgets-search': 'search',153 'search #widgets-search': 'search',154 151 'focus .widget-tpl' : 'focus', 155 152 'click .widget-tpl' : '_submit', … … 164 161 currentSidebarControl: null, 165 162 $search: null, 163 $clearResults: null, 164 searchMatchesCount: null, 166 165 167 166 initialize: function() { … … 170 169 this.$search = $( '#widgets-search' ); 171 170 171 this.$clearResults = this.$el.find( '.clear-results' ); 172 172 173 _.bindAll( this, 'close' ); 173 174 … … 175 176 176 177 this.updateList(); 178 179 // Set the initial search count to the number of available widgets. 180 this.searchMatchesCount = this.collection.length; 177 181 178 182 // If the available widgets panel is open and the customize controls are … … 186 190 } ); 187 191 192 // Clear the search results and trigger a `keyup` event to fire a new search. 193 this.$clearResults.on( 'click', function() { 194 self.$search.val( '' ).focus().trigger( 'keyup' ); 195 } ); 196 188 197 // Close the panel if the URL in the preview changes 189 198 api.previewer.bind( 'url', this.close ); … … 195 204 196 205 this.collection.doSearch( event.target.value ); 206 // Update the search matches count. 207 this.updateSearchMatchesCount(); 208 // Announce how many search results. 209 this.announceSearchMatches(); 197 210 198 211 // Remove a widget from being selected if it is no longer visible … … 215 228 } 216 229 } 217 }, 230 231 // Toggle the clear search results button. 232 if ( '' !== event.target.value ) { 233 this.$clearResults.addClass( 'is-visible' ); 234 } else if ( '' === event.target.value ) { 235 this.$clearResults.removeClass( 'is-visible' ); 236 } 237 238 // Set a CSS class on the search container when there are no search results. 239 if ( ! this.searchMatchesCount ) { 240 this.$el.addClass( 'no-widgets-found' ); 241 } else { 242 this.$el.removeClass( 'no-widgets-found' ); 243 } 244 }, 245 246 // Update the count of the available widgets that have the `search_matched` attribute. 247 updateSearchMatchesCount: function() { 248 this.searchMatchesCount = this.collection.where({ search_matched: true }).length; 249 }, 250 251 // Send a message to the aria-live region to announce how many search results. 252 announceSearchMatches: _.debounce( function() { 253 var message = l10n.widgetsFound.replace( '%d', this.searchMatchesCount ) ; 254 255 if ( ! this.searchMatchesCount ) { 256 message = l10n.noWidgetsFound; 257 } 258 259 wp.a11y.speak( message ); 260 }, 500 ), 218 261 219 262 // Changes visibility of available widgets -
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r38672 r38709 892 892 <span class="spinner"></span> 893 893 </div> 894 <div class="search-icon" aria-hidden="true"></div> 894 895 <button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button> 895 896 <ul class="accordion-section-content available-menu-items-list" data-type="search"></ul> -
trunk/src/wp-includes/class-wp-customize-widgets.php
r38672 r38709 734 734 'reorderModeOff' => __( 'Reorder mode closed' ), 735 735 'reorderLabelOn' => esc_attr__( 'Reorder widgets' ), 736 'reorderLabelOff' => esc_attr__( 'Close reorder mode' ), 736 'widgetsFound' => __( 'Number of widgets found: %d' ), 737 'noWidgetsFound' => __( 'No widgets found.' ), 737 738 ), 738 739 'tpl' => array( … … 778 779 <div id="available-widgets-filter"> 779 780 <label class="screen-reader-text" for="widgets-search"><?php _e( 'Search Widgets' ); ?></label> 780 <input type="search" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets…' ) ?>" /> 781 <input type="text" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets…' ) ?>" aria-describedby="widgets-search-desc" /> 782 <div class="search-icon" aria-hidden="true"></div> 783 <button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button> 784 <p class="screen-reader-text" id="widgets-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p> 781 785 </div> 782 786 <div id="available-widgets-list"> … … 786 790 </div> 787 791 <?php endforeach; ?> 792 <p class="no-widgets-found-message"><?php _e( 'No widgets found.' ); ?></p> 788 793 </div><!-- #available-widgets-list --> 789 794 </div><!-- #available-widgets -->
Note: See TracChangeset
for help on using the changeset viewer.