Skip to content

Commit 1062f0e

Browse files
committed
fix(site): ensure 100% Lighthouse accessibility/SEO and IsItAgentReady markdown/WebMCP compliance
1 parent dcb0b11 commit 1062f0e

6 files changed

Lines changed: 56 additions & 23 deletions

File tree

‎apps/site/src/components/ChatModal.astro‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<aside
66
id="aj-agent-drawer"
7+
data-markdown-ignore="true"
78
class="hidden fixed top-0 right-0 bottom-0 z-50 w-full sm:w-[var(--aj-drawer-width,420px)] flex-col border-l border-border bg-card text-foreground shadow-2xl select-none sm:select-auto"
89
aria-label="Ask Agent AJ"
910
>
@@ -71,7 +72,7 @@
7172
<div class="flex items-center gap-2.5">
7273
<img src="/icon.svg" alt="Agent AJ" class="size-8 rounded-lg object-contain bg-primary/10 p-1" width="32" height="32" />
7374
<div>
74-
<h3 class="font-semibold text-sm text-foreground">Agent AJ</h3>
75+
<div class="font-semibold text-sm text-foreground">Agent AJ</div>
7576
<p class="text-[11px] text-muted-foreground">Sanity Content Lake • Cloudflare Clairic</p>
7677
</div>
7778
</div>
@@ -115,14 +116,18 @@
115116
<form
116117
id="ai-chat-form"
117118
class="border-t border-border p-3 bg-background/40 flex flex-col gap-2 shrink-0"
119+
toolname="ask_agent_aj"
120+
tooldescription="Ask Agent AJ questions about CodingCat.dev podcasts, tutorials, guests, and transcripts"
118121
>
119122
<div class="rounded-lg border border-border bg-background focus-within:border-primary/60 focus-within:ring-1 focus-within:ring-primary/40 transition-all p-2.5">
120123
<label for="ai-chat-input" class="sr-only">Ask anything about CodingCat.dev</label>
121124
<textarea
122125
id="ai-chat-input"
126+
name="prompt"
123127
rows="2"
124128
placeholder="Ask anything about CodingCat.dev..."
125129
class="w-full resize-none bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus:outline-none leading-relaxed"
130+
toolparamdescription="Natural language question for Agent AJ"
126131
></textarea>
127132
</div>
128133
<div class="flex items-center justify-between px-0.5">

‎apps/site/src/components/Header.astro‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const desktopLinks = navLinks.filter((link) => link?.sideOnly !== true);
3232
id="search-header-trigger"
3333
data-track="search_open"
3434
data-track-label="header_search"
35-
class="inline-flex items-center justify-between gap-3 rounded-full px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors border border-border/70 cursor-pointer"
35+
class="inline-flex min-h-8 min-w-8 items-center justify-center sm:justify-between gap-3 rounded-full px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors border border-border/70 cursor-pointer"
3636
aria-label="Search CodingCat.dev (⌘K)"
3737
>
3838
<span class="inline-flex items-center gap-1.5">
@@ -56,7 +56,7 @@ const desktopLinks = navLinks.filter((link) => link?.sideOnly !== true);
5656
<button
5757
type="button"
5858
id="ask-agent-header-trigger"
59-
class="inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 font-mono text-[11px] uppercase tracking-wider text-foreground hover:bg-accent transition-colors border border-border/70 cursor-pointer"
59+
class="inline-flex min-h-8 min-w-8 items-center justify-center gap-1.5 rounded-full px-3 py-1.5 font-mono text-[11px] uppercase tracking-wider text-foreground hover:bg-accent transition-colors border border-border/70 cursor-pointer"
6060
aria-label="Ask Agent AJ"
6161
>
6262
<svg

‎apps/site/src/components/SearchModal.astro‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
<div id="modal-state-empty" class="hidden flex-col items-center justify-center py-10 text-center px-4">
223223
<p class="text-sm font-semibold text-foreground mb-1" id="modal-empty-msg">No results found</p>
224224
<p class="text-xs text-muted-foreground">
225-
Press <kbd class="font-mono bg-muted px-1.5 py-0.5 rounded border border-border">↵</kbd> on <strong>Ask agent</strong> above to ask Agent AJ directly.
225+
Press <kbd class="font-mono bg-muted text-foreground px-1.5 py-0.5 rounded border border-border">↵</kbd> on <strong>Ask agent</strong> above to ask Agent AJ directly.
226226
</p>
227227
</div>
228228

@@ -238,9 +238,9 @@
238238
<!-- Footer with Keyboard Hints -->
239239
<div class="flex items-center justify-between gap-2 border-t border-border px-4 py-2 text-[11px] text-muted-foreground bg-muted/20">
240240
<div class="flex items-center gap-3">
241-
<span><kbd class="font-mono bg-muted px-1 py-0.5 rounded border border-border">↑</kbd> <kbd class="font-mono bg-muted px-1 py-0.5 rounded border border-border">↓</kbd> navigate</span>
242-
<span><kbd class="font-mono bg-muted px-1 py-0.5 rounded border border-border">↵</kbd> select</span>
243-
<span><kbd class="font-mono bg-muted px-1 py-0.5 rounded border border-border">esc</kbd> close</span>
241+
<span><kbd class="font-mono bg-muted text-foreground px-1 py-0.5 rounded border border-border">↑</kbd> <kbd class="font-mono bg-muted text-foreground px-1 py-0.5 rounded border border-border">↓</kbd> navigate</span>
242+
<span><kbd class="font-mono bg-muted text-foreground px-1 py-0.5 rounded border border-border">↵</kbd> select</span>
243+
<span><kbd class="font-mono bg-muted text-foreground px-1 py-0.5 rounded border border-border">esc</kbd> close</span>
244244
</div>
245245
<span id="modal-results-count" class="font-mono text-[11px]"></span>
246246
</div>

‎apps/site/src/lib/html-to-markdown.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export function htmlToMarkdown(html: string, pageUrl?: string): string {
2020
.replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, "")
2121
.replace(/<svg\b[^<]*(?:(?!<\/svg>)<[^<]*)*<\/svg>/gi, "")
2222
.replace(/<dialog\b[^<]*(?:(?!<\/dialog>)<[^<]*)*<\/dialog>/gi, "")
23+
.replace(
24+
/<aside\b[^>]*id=["']aj-agent-drawer["'][^>]*>[\s\S]*?<\/aside>/gi,
25+
"",
26+
)
2327
.replace(
2428
/<div[^>]*class=["'][^"']*transcript-widget[^"']*["'][^>]*>[\s\S]*?<\/footer>\s*<\/div>\s*<\/div>\s*<\/div>/gi,
2529
"",

‎apps/site/src/pages/search.astro‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ import BaseLayout from "@/layouts/BaseLayout.astro";
2424

2525
<!-- Search Input Bar -->
2626
<div class="flex flex-col gap-2 w-full max-w-4xl">
27-
<form id="search-page-form" class="relative w-full" onsubmit="return false">
27+
<form
28+
id="search-page-form"
29+
action="/search"
30+
method="GET"
31+
class="relative w-full"
32+
toolname="search_content"
33+
tooldescription="Search CodingCat.dev web development tutorials, blog posts, and podcasts"
34+
onsubmit="return false"
35+
>
2836
<label for="search-input" class="sr-only">Search</label>
2937
<div class="relative flex items-center">
3038
<div class="absolute left-3.5 text-muted-foreground pointer-events-none" aria-hidden="true">
@@ -40,6 +48,7 @@ import BaseLayout from "@/layouts/BaseLayout.astro";
4048
autocomplete="off"
4149
placeholder="Search in CodingCat.dev..."
4250
class="w-full rounded-xl border border-input bg-card pl-11 pr-12 py-3.5 text-base md:text-lg shadow-xs placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary transition-all"
51+
toolparamdescription="Search keyword or technical topic"
4352
/>
4453
<button
4554
type="button"
@@ -135,7 +144,7 @@ import BaseLayout from "@/layouts/BaseLayout.astro";
135144
<span id="search-count-text"></span>
136145
<div class="flex items-center gap-2">
137146
<span id="search-clairic-pill" class="hidden rounded-full border border-primary/30 bg-primary/10 px-2.5 py-0.5 font-mono text-[11px] font-semibold text-primary"></span>
138-
<span id="search-powered-by" class="text-[11px] opacity-75">Sanity Semantic Search • Clairic</span>
147+
<span id="search-powered-by" class="text-[11px]">Sanity Semantic Search • Clairic</span>
139148
</div>
140149
</div>
141150

‎apps/site/tests/tier1-features.test.mjs‎

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,24 +1735,29 @@ describe("Tier 1 - Feature Coverage", () => {
17351735
),
17361736
);
17371737

1738-
// 3. htmlToMarkdown strips client-only interactive transcript modal chrome
1738+
// 3. htmlToMarkdown strips client-only interactive transcript modal chrome and Ask Agent drawer
17391739
const { htmlToMarkdown } = loadModule("src/lib/html-to-markdown.ts");
17401740
const sampleHtml = `
1741-
<main>
1742-
<article>
1743-
<h1>Sample Episode</h1>
1744-
<div class="transcript-widget inline-block">
1745-
<button class="transcript-open-btn">View Transcript</button>
1746-
<div class="transcript-modal hidden">
1747-
<div>
1748-
<p>Fetching transcript from YouTube...</p>
1749-
<footer><span>Loading transcript...</span></footer>
1741+
<body>
1742+
<main>
1743+
<article>
1744+
<h1>Sample Episode</h1>
1745+
<div class="transcript-widget inline-block">
1746+
<button class="transcript-open-btn">View Transcript</button>
1747+
<div class="transcript-modal hidden">
1748+
<div>
1749+
<p>Fetching transcript from YouTube...</p>
1750+
<footer><span>Loading transcript...</span></footer>
1751+
</div>
17501752
</div>
17511753
</div>
1752-
</div>
1753-
<p>Real episode content.</p>
1754-
</article>
1755-
</main>
1754+
<p>Real episode content.</p>
1755+
</article>
1756+
</main>
1757+
<aside id="aj-agent-drawer" data-markdown-ignore="true">
1758+
<p>Ask anything about CodingCat.dev podcasts, tutorials, guests, or transcripts.</p>
1759+
</aside>
1760+
</body>
17561761
`;
17571762
const md = htmlToMarkdown(
17581763
sampleHtml,
@@ -1763,6 +1768,10 @@ describe("Tier 1 - Feature Coverage", () => {
17631768
!md.includes("Fetching transcript from YouTube"),
17641769
"Must strip client-only modal loading skeleton from Markdown",
17651770
);
1771+
assert.ok(
1772+
!md.includes("Ask anything about CodingCat.dev podcasts"),
1773+
"Must strip Ask Agent drawer from Markdown output",
1774+
);
17661775
});
17671776

17681777
it("7.20 Agent AJ /api/chat integrates Cloudflare Clairic (@cf/cloudflare/clairic) extraction cascade and fastpath fallback", async () => {
@@ -1869,6 +1878,7 @@ describe("Tier 1 - Feature Coverage", () => {
18691878
assert.ok(chatDrawerSource.includes("aj-agent-drawer"));
18701879
assert.ok(chatDrawerSource.includes("aj-drawer-resize-handle"));
18711880
assert.ok(chatDrawerSource.includes("cc_aj_drawer_open"));
1881+
assert.ok(chatDrawerSource.includes('toolname="ask_agent_aj"'));
18721882
assert.ok(
18731883
!chatDrawerSource.includes('id="ai-chat-open-btn"'),
18741884
"Must remove floating bottom-right Ask Agent AJ button",
@@ -1880,6 +1890,11 @@ describe("Tier 1 - Feature Coverage", () => {
18801890
);
18811891
assert.ok(searchPageSource.includes("search-mode-ai-btn"));
18821892
assert.ok(searchPageSource.includes("search-clairic-pill"));
1893+
assert.ok(searchPageSource.includes('toolname="search_content"'));
1894+
assert.ok(
1895+
!searchPageSource.includes("opacity-75"),
1896+
"Must not reduce text-muted-foreground contrast with opacity-75",
1897+
);
18831898
});
18841899
});
18851900
});

0 commit comments

Comments
 (0)