diff --git a/layouts/_default/search.html b/layouts/_default/search.html
index 841cd4276baa..38ad956b381b 100644
--- a/layouts/_default/search.html
+++ b/layouts/_default/search.html
@@ -67,13 +67,8 @@
{{ .Title }}
// Set the value of the input field to the query parameter
searchInput.value = query;
- // Trigger the input event to simulate user typing
- const event = new Event("input", {
- bubbles: true,
- cancelable: true,
- });
- // Trigger the input event for the search input
- searchInput.dispatchEvent(event);
+ // Directly call the search function
+ await onPageSearch({ target: { value: query } });
searchInput.focus();
});