Skip to content

Open-source, local-first social media research agent for Instagram, TikTok, and LinkedIn. Jev routes read-only steps; socai CLI captures cited browser evidence.

Give textarea#query a persistent accessible label (#75)

RogueAlg0f622e086ebdb
diff --git a/public/index.html b/public/index.html
index 461c211..b775efa 100644
--- a/public/index.html
+++ b/public/index.html
@@ -41,6 +41,7 @@
<p class="intro">Describe a social research goal. Jev chooses what to search and which posts or profiles to open next. socai carries out each step in your browser.</p>
<form id="search-form" class="composer">
+ <label for="query" class="visually-hidden">Research goal</label>
<textarea id="query" name="query" required autocomplete="off" rows="3" placeholder="Find emerging AI creators and their most engaging posts"></textarea>
<div id="platform-notice" class="platform-notice hidden" role="status" aria-live="polite"></div>
<div class="composer-controls">
diff --git a/public/styles.css b/public/styles.css
index 06c631a..5f093b0 100644
--- a/public/styles.css
+++ b/public/styles.css
@@ -17,6 +17,17 @@ body { margin: 0; overflow: hidden; color: var(--ink); background: var(--paper);
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
+.visually-hidden {
+ position: absolute !important;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ white-space: nowrap;
+ border: 0;
+}
.app-shell { height: 100vh; display: flex; flex-direction: column; }
.topbar { position: relative; z-index: 20; flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px; border-bottom: 1px solid var(--ink); background: rgba(248, 251, 255, .94); backdrop-filter: blur(14px); }
diff --git a/test/query-label.test.js b/test/query-label.test.js
new file mode 100644
index 0000000..f55ad19
--- /dev/null
+++ b/test/query-label.test.js
@@ -0,0 +1,55 @@
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+import test from "node:test";
+
+const indexHtml = await readFile(
+ new URL("../public/index.html", import.meta.url),
+ "utf8",
+);
+const stylesCss = await readFile(
+ new URL("../public/styles.css", import.meta.url),
+ "utf8",
+);
+
+function labelFor(html, targetId) {
+ const match = html.match(
+ new RegExp(`<label\\b[^>]*\\bfor="${targetId}"[^>]*>([\\s\\S]*?)</label>`, "i"),
+ );
+ return match ? match[1] : null;
+}
+
+test("textarea#query keeps its placeholder and required behavior", () => {
+ const match = indexHtml.match(/<textarea\b[^>]*\bid="query"[^>]*>/i);
+ assert.ok(match, "expected a textarea with id=\"query\"");
+ assert.match(match[0], /\brequired\b/i, "textarea#query must stay required");
+ assert.match(
+ match[0],
+ /placeholder="Find emerging AI creators and their most engaging posts"/,
+ "textarea#query must keep its example placeholder",
+ );
+});
+
+test("textarea#query has an explicit associated label with non-empty text", () => {
+ const labelText = labelFor(indexHtml, "query");
+ assert.ok(labelText !== null, 'expected a <label for="query"> element');
+ assert.notEqual(
+ labelText.replace(/<[^>]*>/g, "").trim(),
+ "",
+ "the label for textarea#query must contain non-empty text",
+ );
+});
+
+test("the query label does not change the visible layout", () => {
+ const match = indexHtml.match(/<label\b[^>]*\bfor="query"[^>]*>/i);
+ assert.ok(match, 'expected a <label for="query"> element');
+ assert.match(
+ match[0],
+ /\bclass="[^"]*\bvisually-hidden\b[^"]*"/i,
+ "the query label must use the visually-hidden helper so the layout is unchanged",
+ );
+ assert.match(
+ stylesCss,
+ /\.visually-hidden\s*\{/i,
+ "expected a .visually-hidden rule in public/styles.css",
+ );
+});