diff --git src/js/_enqueues/wp/updates.js src/js/_enqueues/wp/updates.js
index 1e101f0c59..6367ec0a08 100644
|
|
|
139 | 139 | */ |
140 | 140 | wp.updates.searchTerm = ''; |
141 | 141 | |
| 142 | /** |
| 143 | * Minimum number of characters before an ajax search is fired. |
| 144 | * |
| 145 | * @since 5.4.0 |
| 146 | * |
| 147 | * @type {number} |
| 148 | */ |
| 149 | wp.updates.searchMinCharacters = 2; |
| 150 | |
142 | 151 | /** |
143 | 152 | * Whether filesystem credentials need to be requested from the user. |
144 | 153 | * |
… |
… |
|
2502 | 2511 | $pluginInstallSearch.attr( 'aria-describedby', 'live-search-desc' ); |
2503 | 2512 | } |
2504 | 2513 | |
| 2514 | // Track the previous search string length. |
| 2515 | var previousSearchStringLength = 0; |
| 2516 | wp.updates.shouldSearch = function( searchStringLength ) { |
| 2517 | var shouldSearch = searchStringLength >= wp.updates.searchMinCharacters || |
| 2518 | previousSearchStringLength >= wp.updates.searchMinCharacters; |
| 2519 | previousSearchStringLength = searchStringLength; |
| 2520 | return shouldSearch; |
| 2521 | }; |
| 2522 | |
2505 | 2523 | /** |
2506 | 2524 | * Handles changes to the plugin search box on the new-plugin page, |
2507 | 2525 | * searching the repository dynamically. |
… |
… |
|
2509 | 2527 | * @since 4.6.0 |
2510 | 2528 | */ |
2511 | 2529 | $pluginInstallSearch.on( 'keyup input', _.debounce( function( event, eventtype ) { |
2512 | | var $searchTab = $( '.plugin-install-search' ), data, searchLocation; |
| 2530 | var $searchTab = $( '.plugin-install-search' ), data, searchLocation, |
| 2531 | searchStringLength = $pluginInstallSearch.val().length; |
2513 | 2532 | |
2514 | 2533 | data = { |
2515 | 2534 | _ajax_nonce: wp.updates.ajaxNonce, |
… |
… |
|
2520 | 2539 | }; |
2521 | 2540 | searchLocation = location.href.split( '?' )[ 0 ] + '?' + $.param( _.omit( data, [ '_ajax_nonce', 'pagenow' ] ) ); |
2522 | 2541 | |
| 2542 | // Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in. |
| 2543 | if ( wp.updates.shouldSearch( searchStringLength ) ) { |
| 2544 | $pluginInstallSearch.attr( 'autocomplete', 'off' ); |
| 2545 | } else { |
| 2546 | $pluginInstallSearch.attr( 'autocomplete', 'on' ); |
| 2547 | return; |
| 2548 | } |
| 2549 | |
2523 | 2550 | // Clear on escape. |
2524 | 2551 | if ( 'keyup' === event.type && 27 === event.which ) { |
2525 | 2552 | event.target.value = ''; |
… |
… |
|
2579 | 2606 | |
2580 | 2607 | if ( $pluginSearch.length ) { |
2581 | 2608 | $pluginSearch.attr( 'aria-describedby', 'live-search-desc' ); |
| 2609 | |
2582 | 2610 | } |
2583 | 2611 | |
2584 | 2612 | /** |
… |
… |
|
2594 | 2622 | pagenow: pagenow, |
2595 | 2623 | plugin_status: 'all' |
2596 | 2624 | }, |
2597 | | queryArgs; |
| 2625 | queryArgs, |
| 2626 | searchStringLength = $pluginSearch.val().length; |
| 2627 | |
| 2628 | // Set the autocomplete attribute, turning off autocomplete 1 character before ajax search kicks in. |
| 2629 | if ( wp.updates.shouldSearch( searchStringLength ) ) { |
| 2630 | $pluginSearch.attr( 'autocomplete', 'off' ); |
| 2631 | } else { |
| 2632 | $pluginSearch.attr( 'autocomplete', 'on' ); |
| 2633 | return; |
| 2634 | } |
2598 | 2635 | |
2599 | 2636 | // Clear on escape. |
2600 | 2637 | if ( 'keyup' === event.type && 27 === event.which ) { |
diff --git src/wp-includes/blocks/latest-comments.php src/wp-includes/blocks/latest-comments.php
index 6343a46d0b..555a125c4a 100644
|
|
function wp_latest_comments_draft_or_post_title( $post = 0 ) { |
41 | 41 | * @return string Returns the post content with latest comments added. |
42 | 42 | */ |
43 | 43 | function render_block_core_latest_comments( $attributes = array() ) { |
| 44 | // This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php. |
44 | 45 | $comments = get_comments( |
45 | | // This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php. |
46 | 46 | apply_filters( |
47 | 47 | 'widget_comments_args', |
48 | 48 | array( |