mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
fix: add autofocus in search bar and update search result title style (#603)
This commit is contained in:
@@ -45,8 +45,9 @@ const backUrl = SITE.showBackButton ? `${Astro.url.pathname}` : "/";
|
||||
// Init pagefind ui
|
||||
const search = new PagefindUI({
|
||||
element: "#pagefind-search",
|
||||
showSubResults: true,
|
||||
autofocus: true,
|
||||
showImages: false,
|
||||
showSubResults: true,
|
||||
processTerm: function (term: string) {
|
||||
params.set("q", term); // Update the `q` parameter in the URL
|
||||
history.replaceState(history.state, "", "?" + params.toString()); // Push the new URL without reloading
|
||||
@@ -119,6 +120,8 @@ const backUrl = SITE.showBackButton ? `${Astro.url.pathname}` : "/";
|
||||
color: var(--accent);
|
||||
outline-offset: 1px;
|
||||
outline-color: var(--accent);
|
||||
text-decoration-style: dashed;
|
||||
text-underline-offset: 4px;
|
||||
}
|
||||
|
||||
.pagefind-ui__result-title a:focus-visible,
|
||||
|
||||
Reference in New Issue
Block a user