Open-source, local-first social media research agent for Instagram, TikTok, and LinkedIn. Jev routes read-only steps; socai CLI captures cited browser evidence.
JavaScript agent-skillsai-agentsbrowser-agentbrowser-automationdecision-modeldeep-researchinstagramjevlinkedinlocal-firstopen-sourceosintresearch-agentsocaisocial-listeningsocial-mediasocial-media-researchsocmintsystem-onetiktok
a11y: give the evidence table a programmatic accessible name (#89)
Maham Abidbc7b0969926f
diff --git a/public/index.html b/public/index.htmlindex 6b80797..bb92c65 100644--- a/public/index.html+++ b/public/index.html@@ -115,8 +115,8 @@<div id="cards" class="cards"></div><section id="evidence-table" class="data-section">- <div class="section-head"><p class="eyebrow">COMPLETE TABLE</p><span>All returned records</span></div>- <div class="table-scroll"><table><thead id="table-head"></thead><tbody id="table-body"></tbody></table></div>+ <div class="section-head"><p class="eyebrow" id="evidence-table-heading">COMPLETE TABLE</p><span id="evidence-table-desc">All returned records</span></div>+ <div class="table-scroll"><table aria-labelledby="evidence-table-heading evidence-table-desc"><thead id="table-head"></thead><tbody id="table-body"></tbody></table></div></section><section id="research-report-section" class="report-section">diff --git a/test/evidence-table-name.test.js b/test/evidence-table-name.test.jsnew file mode 100644index 0000000..ee36f2b--- /dev/null+++ b/test/evidence-table-name.test.js@@ -0,0 +1,80 @@+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",+);++function attr(tagHtml, name) {+ const match = tagHtml.match(new RegExp(`\\b${name}="([^"]*)"`, "i"));+ return match ? match[1] : null;+}++function elementById(html, id) {+ const match = html.match(+ new RegExp(`<([a-z0-9]+)\\b[^>]*\\bid="${id}"[^>]*>([\\s\\S]*?)</\\1>`, "i"),+ );+ return match ? match[2] : null;+}++function stripTags(text) {+ return text.replace(/<[^>]*>/g, "").trim();+}++test("the evidence table has a non-empty accessible name built from the existing heading", () => {+ const sectionMatch = indexHtml.match(+ /<section\b[^>]*\bid="evidence-table"[^>]*>([\s\S]*?)<\/section>/i,+ );+ assert.ok(sectionMatch, 'expected a <section id="evidence-table"> element');+ const section = sectionMatch[1];++ const tableMatch = section.match(/<table\b[^>]*>/i);+ assert.ok(tableMatch, "expected a <table> inside the evidence-table section");+ const tableTag = tableMatch[0];++ const labelledBy = attr(tableTag, "aria-labelledby");+ assert.ok(+ labelledBy,+ "the evidence table must have an aria-labelledby attribute referencing its heading",+ );++ const ids = labelledBy.trim().split(/\s+/);+ assert.ok(ids.length >= 1, "aria-labelledby must reference at least one id");++ const resolvedName = ids+ .map((id) => {+ const content = elementById(indexHtml, id);+ assert.ok(content !== null, `expected an element with id="${id}" referenced by aria-labelledby`);+ return stripTags(content);+ })+ .join(" ")+ .trim();++ assert.notEqual(resolvedName, "", "the resolved accessible name must be non-empty");+ assert.match(resolvedName, /COMPLETE TABLE/i, "the accessible name should include the visible heading text");+});++test("the evidence table accessible-name fix does not change visible copy or dynamic hooks", () => {+ assert.match(+ indexHtml,+ /<p class="eyebrow"[^>]*>COMPLETE TABLE<\/p>/i,+ "the visible COMPLETE TABLE text must be unchanged",+ );+ assert.match(+ indexHtml,+ />All returned records<\/span>/i,+ "the visible 'All returned records' text must be unchanged",+ );+ assert.match(+ indexHtml,+ /<thead\b[^>]*\bid="table-head"[^>]*><\/thead>/i,+ "#table-head must remain intact for dynamic rendering",+ );+ assert.match(+ indexHtml,+ /<tbody\b[^>]*\bid="table-body"[^>]*><\/tbody>/i,+ "#table-body must remain intact for dynamic rendering",+ );+});\ No newline at end of file