Skip to content

Commit e40af09

Browse files
MasssiveJuice08ndrooodependabot[bot]
authored
Update Quartz to d27c292 (#77)
* feat(search): keyboard-accessible search button (#1331) * Use a `<button>` for search * Fix search button styles to match preexisting styling * Remove additional native button properties. * Invoke search button on click or keyboard. * Reorganize search button DOM hierarchy * Restore focus to the search button when exiting the search overlay * Run prettier on Search.tsx * chore(deps): bump preact from 10.22.1 to 10.23.2 (#1342) Bumps [preact](https://github.com/preactjs/preact) from 10.22.1 to 10.23.2. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](preactjs/preact@10.22.1...10.23.2) --- updated-dependencies: - dependency-name: preact dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump shiki from 1.10.3 to 1.12.1 (#1344) Bumps [shiki](https://github.com/shikijs/shiki/tree/HEAD/packages/shiki) from 1.10.3 to 1.12.1. - [Release notes](https://github.com/shikijs/shiki/releases) - [Changelog](https://github.com/shikijs/shiki/blob/main/CHANGELOG.md) - [Commits](https://github.com/shikijs/shiki/commits/v1.12.1/packages/shiki) --- updated-dependencies: - dependency-name: shiki dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: Mark the external link icon as aria-hidden (#1346) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Andrew <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent e1ee078 commit e40af09

File tree

7 files changed

+33
-34
lines changed

7 files changed

+33
-34
lines changed

package-lock.json

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"mdast-util-to-hast": "^13.2.0",
5959
"mdast-util-to-string": "^4.0.0",
6060
"micromorph": "^0.4.5",
61-
"preact": "^10.22.1",
61+
"preact": "^10.23.2",
6262
"preact-render-to-string": "^6.5.7",
6363
"pretty-bytes": "^6.1.1",
6464
"pretty-time": "^1.1.0",
@@ -81,7 +81,7 @@
8181
"rfdc": "^1.4.1",
8282
"rimraf": "^6.0.1",
8383
"serve-handler": "^6.1.5",
84-
"shiki": "^1.10.3",
84+
"shiki": "^1.12.1",
8585
"source-map-support": "^0.5.21",
8686
"to-vfile": "^8.0.0",
8787
"toml": "^3.0.0",

quartz/components/Search.tsx

+4-12
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,16 @@ export default ((userOpts?: Partial<SearchOptions>) => {
1919
const searchPlaceholder = i18n(cfg.locale).components.search.searchBarPlaceholder
2020
return (
2121
<div class={classNames(displayClass, "search")}>
22-
<div id="search-icon">
22+
<button class="search-button" id="search-button">
2323
<p>{i18n(cfg.locale).components.search.title}</p>
24-
<div></div>
25-
<svg
26-
tabIndex={0}
27-
aria-labelledby="title desc"
28-
role="img"
29-
xmlns="http://www.w3.org/2000/svg"
30-
viewBox="0 0 19.9 19.7"
31-
>
32-
<title id="title">Search</title>
33-
<desc id="desc">Search</desc>
24+
<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7">
25+
<title>Search</title>
3426
<g class="search-path" fill="none">
3527
<path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4" />
3628
<circle cx="8" cy="8" r="7" />
3729
</g>
3830
</svg>
39-
</div>
31+
</button>
4032
<div id="search-container">
4133
<div id="search-space">
4234
<input

quartz/components/scripts/search.inline.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
148148
const data = await fetchData
149149
const container = document.getElementById("search-container")
150150
const sidebar = container?.closest(".sidebar") as HTMLElement
151-
const searchIcon = document.getElementById("search-icon")
151+
const searchButton = document.getElementById("search-button")
152152
const searchBar = document.getElementById("search-bar") as HTMLInputElement | null
153153
const searchLayout = document.getElementById("search-layout")
154154
const idDataMap = Object.keys(data) as FullSlug[]
@@ -191,6 +191,8 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
191191
}
192192

193193
searchType = "basic" // reset search type after closing
194+
195+
searchButton?.focus()
194196
}
195197

196198
function showSearch(searchTypeNew: SearchType) {
@@ -458,8 +460,8 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
458460

459461
document.addEventListener("keydown", shortcutHandler)
460462
window.addCleanup(() => document.removeEventListener("keydown", shortcutHandler))
461-
searchIcon?.addEventListener("click", () => showSearch("basic"))
462-
window.addCleanup(() => searchIcon?.removeEventListener("click", () => showSearch("basic")))
463+
searchButton?.addEventListener("click", () => showSearch("basic"))
464+
window.addCleanup(() => searchButton?.removeEventListener("click", () => showSearch("basic")))
463465
searchBar?.addEventListener("input", onType)
464466
window.addCleanup(() => searchBar?.removeEventListener("input", onType))
465467

quartz/components/scripts/util.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export function registerEscapeHandler(outsideContainer: HTMLElement | null, cb:
33
function click(this: HTMLElement, e: HTMLElementEventMap["click"]) {
44
if (e.target !== this) return
55
e.preventDefault()
6+
e.stopPropagation()
67
cb()
78
}
89

quartz/components/styles/search.scss

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55
max-width: 14rem;
66
flex-grow: 0.3;
77

8-
& > #search-icon {
8+
& > .search-button {
99
background-color: var(--lightgray);
10+
border: none;
1011
border-radius: 4px;
12+
font-family: inherit;
13+
font-size: inherit;
1114
height: 2rem;
15+
padding: 0;
1216
display: flex;
1317
align-items: center;
18+
text-align: inherit;
1419
cursor: pointer;
1520
white-space: nowrap;
16-
17-
& > div {
18-
flex-grow: 1;
19-
}
21+
width: 100%;
22+
justify-content: space-between;
2023

2124
& > p {
2225
display: inline;

quartz/plugins/transformers/links.ts

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
6565
type: "element",
6666
tagName: "svg",
6767
properties: {
68+
"aria-hidden": "true",
6869
class: "external-icon",
6970
viewBox: "0 0 512 512",
7071
},

0 commit comments

Comments
 (0)