mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +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
|
// Init pagefind ui
|
||||||
const search = new PagefindUI({
|
const search = new PagefindUI({
|
||||||
element: "#pagefind-search",
|
element: "#pagefind-search",
|
||||||
showSubResults: true,
|
autofocus: true,
|
||||||
showImages: false,
|
showImages: false,
|
||||||
|
showSubResults: true,
|
||||||
processTerm: function (term: string) {
|
processTerm: function (term: string) {
|
||||||
params.set("q", term); // Update the `q` parameter in the URL
|
params.set("q", term); // Update the `q` parameter in the URL
|
||||||
history.replaceState(history.state, "", "?" + params.toString()); // Push the new URL without reloading
|
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);
|
color: var(--accent);
|
||||||
outline-offset: 1px;
|
outline-offset: 1px;
|
||||||
outline-color: var(--accent);
|
outline-color: var(--accent);
|
||||||
|
text-decoration-style: dashed;
|
||||||
|
text-underline-offset: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagefind-ui__result-title a:focus-visible,
|
.pagefind-ui__result-title a:focus-visible,
|
||||||
|
|||||||
Reference in New Issue
Block a user