This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+20 -6
View File
@@ -1406,14 +1406,25 @@
updateQuickSearchResults : function(input) {
var panel, params,
minSearchLength = 2,
q = input.val();
minSearchLength = 1,
q = input.val(),
pageSearchChecklist = $( '#page-search-checklist' );
/*
* Minimum characters for a search. Also avoid a new Ajax search when
* the pressed key (e.g. arrows) doesn't change the searched term.
* Avoid a new Ajax search when the pressed key (e.g. arrows)
* doesn't change the searched term.
*/
if ( q.length < minSearchLength || api.lastSearch == q ) {
if ( api.lastSearch == q ) {
return;
}
/*
* Reset results when search is less than or equal to
* minimum characters for searched term.
*/
if ( q.length <= minSearchLength ) {
pageSearchChecklist.empty();
wp.a11y.speak( wp.i18n.__( 'Search results cleared' ) );
return;
}
@@ -1770,12 +1781,14 @@
$item;
if( ! $items.length ) {
let noResults = wp.i18n.__( 'No results found.' );
const li = $( '<li>' );
const p = $( '<p>', { text: wp.i18n.__( 'No results found.' ) } );
const p = $( '<p>', { text: noResults } );
li.append( p );
$('.categorychecklist', panel).empty().append( li );
$( '.spinner', panel ).removeClass( 'is-active' );
wrapper.addClass( 'has-no-menu-item' );
wp.a11y.speak( noResults, 'assertive' );
return;
}
@@ -1802,6 +1815,7 @@
});
$('.categorychecklist', panel).html( $items );
wp.a11y.speak( wp.i18n.sprintf( wp.i18n.__( '%d Search Results Found' ), $items.length ), 'assertive' );
$( '.spinner', panel ).removeClass( 'is-active' );
wrapper.removeClass( 'has-no-menu-item' );