Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): give every control an accessible name
Yudhi Armyndharisf472cff47ae9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dcd930d89..2efcfac65 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed+- Plugin config fields bind their caption to the control for every field type, not just booleans. Clicking the caption of a text, number, secret, enum or textarea field focused nothing, and screen readers announced those inputs with no name.+- Dashboard toggles expose an accessible name and, for the message-type and recipient groups, their selected state. Their captions sit outside the control, so a screen reader announced anonymous checkboxes and unlabelled buttons.- The image ships the PostgreSQL client, so `backup.sh` and `restore.sh` work in-container with `DATABASE_TYPE=postgres`. Neither `pg_dump` nor `psql` was present, so the backup exited 1 and the restore printed an import that could not be run.- A session launch that fails on a locked database is retried. The classifier looked for `SQLITE_BUSY` in the error message while the driver carries it on `code`, so the session stayed down until a restart.- Meta-hosted ids (`@hosted`, `@hosted.lid`) normalize to the dialect they name. They parsed as unknown before, so a chat surfaced with kind `unknown` and the same id was then refused with a `400` on any write.diff --git a/dashboard/src/a11y-controls.test.ts b/dashboard/src/a11y-controls.test.tsnew file mode 100644index 000000000..70d70d9a0--- /dev/null+++ b/dashboard/src/a11y-controls.test.ts@@ -0,0 +1,333 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';+import { readFileSync, readdirSync } from 'node:fs';+import { fileURLToPath } from 'node:url';+import { dirname, join } from 'node:path';+import ts from 'typescript';++// Two control patterns here render their caption OUTSIDE the control, so neither gets an accessible+// name for free:+//+// - `<label class="toggle-switch">` wraps a checkbox plus a decorative slider span and no text, so+// the wrapping label contributes nothing and screen readers announce an anonymous checkbox.+// - `<div class="toggle-group">` holding buttons is an exclusive choice whose caption is a sibling+// and whose selected option lives only in a CSS class.+//+// Checked across every .tsx under src/, not just pages/, because the pattern is copied around: a+// per-page test stays green while the next page, or a shared component, ships the same defect.+//+// Parsed with the TypeScript compiler rather than scanned with regexes. The regex version of this+// file was defeated six different ways, all of them ordinary code rather than deliberate evasion: a+// `className="toggle-switch toggle-switch-sm"` modifier fell out of the sweep; `accept="image/*"`+// opened a comment-strip window that blanked the markup after it (MessageTester's MIME map does+// exactly this, and was silently deleting 5 KB of the file before the scan); a forward search for+// `type="checkbox"` ran past its own element into the next toggle's; and a body slice ending at the+// first `</div>` stopped before the buttons whenever a group opened with a nested div. An AST knows+// what is a string, what is an attribute, and what is actually nested inside what.+//+// Where it cannot verify something it FAILS rather than skipping: a toggle whose control is a+// wrapper component is reported, not quietly passed, because silence is how every one of those+// evasions read.+//+// KNOWN LIMIT, stated rather than papered over: this is static, so it cannot tell whether a caption+// and the control referencing it render under the SAME condition. `aria-labelledby` pointing at a+// span that is behind a different `&&` resolves to nothing at runtime while passing here. The render+// test in pages/Infrastructure.test.ts closes that for the page carrying most of these controls, by+// resolving each reference against a real DOM; the other pages have no render harness yet.+//+// The vacuity floors sit close to today's counts on purpose. They exist to catch the sweep silently+// finding NOTHING (a renamed class, a moved directory), not to pin an exact inventory. Deleting a+// control legitimately is expected to require lowering them, which is a deliberate edit rather than+// a silent loss of coverage.++const SRC = dirname(fileURLToPath(import.meta.url));+const PAGES = join(SRC, 'pages');++/** Every .tsx under src/, recursively: the patterns below are not confined to pages/. */+function tsxFiles(dir: string): string[] {+ return readdirSync(dir, { withFileTypes: true }).flatMap(entry => {+ const full = join(dir, entry.name);+ if (entry.isDirectory()) return tsxFiles(full);+ return entry.name.endsWith('.tsx') ? [full] : [];+ });+}++type JsxNode = ts.JsxElement | ts.JsxSelfClosingElement;++interface Page {+ file: string;+ source: ts.SourceFile;+}++function pages(): Page[] {+ return tsxFiles(SRC).map(full => {+ const file = full.slice(SRC.length + 1);+ return {+ file,+ source: ts.createSourceFile(file, readFileSync(full, 'utf8'), ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX),+ };+ });+}++/** Every JSX element in the file, opening tags included, in source order. */+function jsxElements(source: ts.SourceFile): JsxNode[] {+ const out: JsxNode[] = [];+ const walk = (node: ts.Node): void => {+ if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) out.push(node);+ ts.forEachChild(node, walk);+ };+ walk(source);+ return out;+}++const opening = (node: JsxNode): ts.JsxOpeningElement | ts.JsxSelfClosingElement =>+ ts.isJsxElement(node) ? node.openingElement : node;++const tagName = (node: JsxNode): string => opening(node).tagName.getText();++function attr(node: JsxNode, name: string): ts.JsxAttribute | undefined {+ return opening(node).attributes.properties.find(+ (p): p is ts.JsxAttribute => ts.isJsxAttribute(p) && p.name.getText() === name,+ );+}++/** A string-literal attribute value, or undefined when it is an expression or absent. */+function literalAttr(node: JsxNode, name: string): string | undefined {+ const found = attr(node, name);+ if (!found?.initializer) return undefined;+ return ts.isStringLiteral(found.initializer) ? found.initializer.text : undefined;+}++/** The attribute's value as written: `"x"` -> `"x"`, `{fieldId}` -> `{fieldId}`. */+function attrText(node: JsxNode, name: string): string | undefined {+ return attr(node, name)?.initializer?.getText();+}++/** The class names on an element, whether written as a literal or a template with a literal head. */+function classes(node: JsxNode): string[] {+ const found = attr(node, 'className');+ if (!found?.initializer) return [];+ const text = ts.isStringLiteral(found.initializer)+ ? found.initializer.text+ : found.initializer.getText().replace(/[`${}'"]/g, ' ');+ return text.split(/\s+/).filter(Boolean);+}++/**+ * The outermost JSX element enclosing `node`: the root of the branch it is returned from. Used to+ * scope a htmlFor lookup, because two branches of the same component can carry the same `{fieldId}`+ * text while only one of them ever renders alongside a given control.+ */+function jsxRoot(node: ts.Node): ts.Node {+ let top = node;+ for (let p = node.parent; p; p = p.parent) {+ if (ts.isJsxElement(p) || ts.isJsxSelfClosingElement(p) || ts.isJsxFragment(p)) top = p;+ }+ return top;+}++/** Descendants of `node`, excluding itself. */+function descendants(node: JsxNode): JsxNode[] {+ const out: JsxNode[] = [];+ const walk = (n: ts.Node): void => {+ if (n !== node && (ts.isJsxElement(n) || ts.isJsxSelfClosingElement(n))) out.push(n);+ ts.forEachChild(n, walk);+ };+ walk(node);+ return out;+}++const line = (source: ts.SourceFile, node: ts.Node): number =>+ source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1;++test('every toggle-switch wraps a checkbox that carries an accessible name', () => {+ const problems: string[] = [];+ let found = 0;++ for (const { file, source } of pages()) {+ for (const node of jsxElements(source)) {+ if (!classes(node).includes('toggle-switch')) continue;+ found++;+ const at = `${file}:${line(source, node)}`;++ const checkboxes = descendants(node).filter(d => literalAttr(d, 'type') === 'checkbox');+ if (checkboxes.length === 0) {+ // Fail closed: a wrapper component may well be labelled correctly, but this test cannot see+ // inside it, and passing on "no checkbox found" is what let an unnamed toggle through before.+ problems.push(+ `${at}: toggle-switch with no inline checkbox to check (control is ${+ descendants(node).map(tagName).join('/') || 'nothing'+ })`,+ );+ continue;+ }++ for (const cb of checkboxes) {+ // The htmlFor branch compares the value as WRITTEN and looks only inside the branch this+ // control is rendered from. Both narrowings matter: accepting "some id and some htmlFor exist+ // in this file" passes a checkbox nothing points at, and searching the whole file lets a+ // sibling branch's identical `{fieldId}` cover for a caption that was just broken.+ const idValue = attrText(cb, 'id');+ const siblings = [jsxRoot(cb), ...descendants(jsxRoot(cb) as JsxNode)].filter(+ (n): n is JsxNode => ts.isJsxElement(n) || ts.isJsxSelfClosingElement(n),+ );+ const named =+ attr(cb, 'aria-labelledby') !== undefined ||+ attr(cb, 'aria-label') !== undefined ||+ (idValue !== undefined && siblings.some(l => attrText(l, 'htmlFor') === idValue));+ if (!named) problems.push(`${at}: checkbox has no accessible name`);+ }+ }+ }++ // Vacuity guard: the sweep means nothing if it stopped finding the controls.+ assert.ok(found >= 10, `expected the dashboard to declare toggle switches, found ${found}`);+ assert.deepEqual(problems, [], problems.join('\n'));+});++test('every button toggle-group is a named group whose options report their state', () => {+ const problems: string[] = [];+ let found = 0;++ for (const { file, source } of pages()) {+ for (const node of jsxElements(source)) {+ if (!classes(node).includes('toggle-group')) continue;+ const inside = descendants(node);+ const buttons = inside.filter(d => tagName(d) === 'button');+ // Groups holding a checkbox are the other pattern (caption + switch + status), covered above.+ if (buttons.length === 0 && inside.some(d => literalAttr(d, 'type') === 'checkbox')) continue;++ found++;+ const at = `${file}:${line(source, node)}`;+ if (attr(node, 'role') === undefined) problems.push(`${at}: toggle-group without a role`);+ if (attr(node, 'aria-labelledby') === undefined && attr(node, 'aria-label') === undefined) {+ problems.push(`${at}: toggle-group with no accessible name`);+ }+ if (buttons.length === 0) {+ // Options built by a subcomponent: cannot verify aria-pressed here, so say so.+ problems.push(+ `${at}: toggle-group whose options are not inline buttons (${inside.map(tagName).join('/') || 'empty'})`,+ );+ continue;+ }+ for (const b of buttons) {+ if (attr(b, 'aria-pressed') === undefined) {+ problems.push(`${file}:${line(source, b)}: toggle-group option reports no pressed state`);+ }+ }+ }+ }++ assert.ok(found >= 2, `expected button toggle-groups to exist, found ${found}`);+ assert.deepEqual(problems, [], problems.join('\n'));+});++test('no aria-labelledby points at an id its own file never defines', () => {+ const dangling: string[] = [];+ let refs = 0;++ for (const { file, source } of pages()) {+ const ids = new Set(+ jsxElements(source)+ .map(n => literalAttr(n, 'id'))+ .filter((v): v is string => v !== undefined),+ );+ for (const node of jsxElements(source)) {+ const ref = literalAttr(node, 'aria-labelledby');+ if (ref === undefined) continue;+ refs++;+ if (!ids.has(ref)) dangling.push(`${file}:${line(source, node)}: aria-labelledby="${ref}"`);+ }+ }++ assert.ok(refs > 0, 'expected aria-labelledby references to exist');+ assert.deepEqual(dangling, [], dangling.join('\n'));+});++test('an id referenced by aria-labelledby is defined exactly once in its file', () => {+ const duplicates: string[] = [];++ for (const { file, source } of pages()) {+ const counts = new Map<string, number>();+ for (const node of jsxElements(source)) {+ const id = literalAttr(node, 'id');+ if (id !== undefined) counts.set(id, (counts.get(id) ?? 0) + 1);+ }+ for (const node of jsxElements(source)) {+ const ref = literalAttr(node, 'aria-labelledby');+ // A duplicate id makes the reference ambiguous: the browser resolves the first, which may not+ // be the caption meant for this control.+ if (ref !== undefined && (counts.get(ref) ?? 0) > 1) {+ duplicates.push(`${file}: id="${ref}" defined ${counts.get(ref)} times`);+ }+ }+ }++ assert.deepEqual([...new Set(duplicates)], [], duplicates.join('\n'));+});++/**+ * ConfigField (Plugins) renders one control per schema property and recurses, so caption and control+ * have to be tied together PER INSTANCE, which is why the id comes from React.useId rather than a+ * constant. Only the boolean branch did that; every other field type rendered a bare label beside a+ * control with no id.+ *+ * Walked as an AST for the same reason as above: the regex version of this check looked at the FIRST+ * `<input` in the function, which is the boolean branch's checkbox, so the text/number/secret input+ * (by far the most common plugin field) was never examined at all.+ */+test('every ConfigField caption is bound, and every single control carries the per-instance id', () => {+ const file = 'Plugins.tsx';+ const source = ts.createSourceFile(+ file,+ readFileSync(join(PAGES, file), 'utf8'),+ ts.ScriptTarget.Latest,+ true,+ ts.ScriptKind.TSX,+ );++ let fn: ts.Node | undefined;+ const findFn = (node: ts.Node): void => {+ if (ts.isFunctionDeclaration(node) && node.name?.getText() === 'ConfigField') fn = node;+ ts.forEachChild(node, findFn);+ };+ findFn(source);+ assert.ok(fn, 'ConfigField not found');++ const inside: JsxNode[] = [];+ const collect = (n: ts.Node): void => {+ if (ts.isJsxElement(n) || ts.isJsxSelfClosingElement(n)) inside.push(n);+ ts.forEachChild(n, collect);+ };+ collect(fn);++ const problems: string[] = [];++ // A label with no htmlFor names nothing, whatever other attributes it carries.+ for (const node of inside) {+ if (tagName(node) !== 'label') continue;+ if (classes(node).includes('toggle-switch')) continue; // wraps its control, checked above+ if (attr(node, 'htmlFor') === undefined) {+ problems.push(`${file}:${line(source, node)}: <label> in ConfigField with no htmlFor`);+ }+ }++ // Every single-value control must carry the id those captions point at. Checked per element, not+ // by counting: a count is satisfied by the branch that was already correct.+ let controls = 0;+ for (const node of inside) {+ const tag = tagName(node);+ if (tag !== 'select' && tag !== 'textarea' && tag !== 'input') continue;+ if (literalAttr(node, 'type') === 'checkbox' && attr(node, 'id') !== undefined) {+ controls++;+ continue;+ }+ controls++;+ if (attr(node, 'id') === undefined) {+ problems.push(`${file}:${line(source, node)}: <${tag}> in ConfigField has no id`);+ }+ }++ assert.ok(controls >= 4, `expected ConfigField to render controls, found ${controls}`);+ assert.deepEqual(problems, [], problems.join('\n'));+});diff --git a/dashboard/src/pages/Infrastructure.test.ts b/dashboard/src/pages/Infrastructure.test.tsindex a8891a660..667bbf2b2 100644--- a/dashboard/src/pages/Infrastructure.test.ts+++ b/dashboard/src/pages/Infrastructure.test.ts@@ -269,6 +269,39 @@ test('Infrastructure renders and the config form hydrates from /status and /conf});});+/**+ * Every toggle is a bare checkbox inside a `<label class="toggle-switch">` whose only other child is+ * the decorative slider span, so the wrapping label contributes no text: a screen reader announced+ * anonymous checkboxes on this page. The visible caption lives in a sibling `.toggle-info > span`,+ * which each checkbox now references with aria-labelledby.+ *+ * This proves the reference actually resolves to text in a real DOM. It covers only the four toggles+ * this fixture renders (SSL, built-in Redis and the rest sit behind other toggles); a11y-controls+ * covers the rest of them, and every other page, structurally.+ */+test('every rendered toggle exposes an accessible name from its visible caption', async () => {+ const { screen } = rtl;+ resetFetchCalls();+ const { container } = renderInfrastructure();+ await screen.findByText('Database Configuration');++ const toggles = Array.from(container.querySelectorAll('label.toggle-switch input[type="checkbox"]'));+ // Guards against a vacuous pass if the page ever stops rendering toggles under this fixture.+ assert.ok(toggles.length >= 4, `expected the open sections to render toggles, found ${toggles.length}`);++ const unnamed = toggles+ .map(input => {+ const id = input.getAttribute('aria-labelledby');+ const name = id ? (container.querySelector(`#${id}`)?.textContent ?? '').trim() : '';+ return { id, name };+ })+ .filter(t => !t.name)+ .map(t => t.id ?? '(no aria-labelledby)');++ // Named, not counted: a failure has to say WHICH toggle lost its caption.+ assert.deepEqual(unnamed, [], `toggles with no accessible name: ${unnamed.join(', ')}`);+});+test('editing a database field and saving PUTs the edited value in the request body', async () => {const { screen, waitFor, fireEvent } = rtl;resetFetchCalls();diff --git a/dashboard/src/pages/Infrastructure.tsx b/dashboard/src/pages/Infrastructure.tsxindex ae2dbf3c7..3f891ec74 100644--- a/dashboard/src/pages/Infrastructure.tsx+++ b/dashboard/src/pages/Infrastructure.tsx@@ -197,12 +197,13 @@ export function Infrastructure() {<><div className="toggle-row toggle-row-spaced"><div className="toggle-info">- <span>{t('infrastructure.database.useBuiltIn')}</span>+ <span id="toggle-db-builtin">{t('infrastructure.database.useBuiltIn')}</span><small>{t('infrastructure.database.builtInDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-db-builtin"checked={configForm.dbConfig.builtIn}onChange={e => configForm.updateDbConfig('builtIn', e.target.checked)}/>@@ -289,12 +290,13 @@ export function Infrastructure() {</div><div className="toggle-row"><div className="toggle-info">- <span>{t('infrastructure.database.ssl')}</span>+ <span id="toggle-db-ssl">{t('infrastructure.database.ssl')}</span><small>{t('infrastructure.database.sslDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-db-ssl"checked={configForm.dbConfig.sslEnabled}onChange={e => configForm.updateDbConfig('sslEnabled', e.target.checked)}/>@@ -304,12 +306,13 @@ export function Infrastructure() {{configForm.dbConfig.sslEnabled && (<div className="toggle-row"><div className="toggle-info">- <span>{t('infrastructure.database.sslRejectUnauthorized')}</span>+ <span id="toggle-db-ssl-reject">{t('infrastructure.database.sslRejectUnauthorized')}</span><small>{t('infrastructure.database.sslRejectUnauthorizedDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-db-ssl-reject"checked={configForm.dbConfig.sslRejectUnauthorized}onChange={e => configForm.updateDbConfig('sslRejectUnauthorized', e.target.checked)}/>@@ -420,12 +423,13 @@ export function Infrastructure() {<div className="config-form"><div className="toggle-row"><div className="toggle-info">- <span>{t('infrastructure.engine.headless')}</span>+ <span id="toggle-engine-headless">{t('infrastructure.engine.headless')}</span><small>{t('infrastructure.engine.headlessDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-engine-headless"checked={configForm.engineConfig.headless}onChange={e => configForm.updateEngineConfig('headless', e.target.checked)}/>@@ -490,12 +494,13 @@ export function Infrastructure() {}}><div className="toggle-info">- <span>{t('infrastructure.redis.enable')}</span>+ <span id="toggle-redis-enable">{t('infrastructure.redis.enable')}</span><small>{t('infrastructure.redis.enableDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-redis-enable"checked={configForm.redisEnabled}onChange={e => configForm.setRedisEnabled(e.target.checked)}/>@@ -507,12 +512,13 @@ export function Infrastructure() {<><div className="toggle-row toggle-row-spaced-bottom"><div className="toggle-info">- <span>{t('infrastructure.redis.useBuiltIn')}</span>+ <span id="toggle-redis-builtin">{t('infrastructure.redis.useBuiltIn')}</span><small>{t('infrastructure.redis.builtInDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-redis-builtin"checked={configForm.redisConfig.builtIn}onChange={e => configForm.updateRedisConfig('builtIn', e.target.checked)}/>@@ -557,12 +563,13 @@ export function Infrastructure() {<div className="toggle-row queue-toggle-row"><div className="toggle-info">- <span>{t('infrastructure.redis.queueTitle')}</span>+ <span id="toggle-queue-enable">{t('infrastructure.redis.queueTitle')}</span><small>{t('infrastructure.redis.queueDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-queue-enable"checked={configForm.queueEnabled}onChange={e => configForm.setQueueEnabled(e.target.checked)}/>@@ -697,12 +704,13 @@ export function Infrastructure() {<><div className="toggle-row toggle-row-spaced"><div className="toggle-info">- <span>{t('infrastructure.storage.useBuiltIn')}</span>+ <span id="toggle-storage-builtin">{t('infrastructure.storage.useBuiltIn')}</span><small>{t('infrastructure.storage.builtInDesc')}</small></div><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="toggle-storage-builtin"checked={configForm.storageConfig.builtIn}onChange={e => configForm.updateStorageConfig('builtIn', e.target.checked)}/>diff --git a/dashboard/src/pages/MessageTester.css b/dashboard/src/pages/MessageTester.cssindex 4e34ef36d..21e1644f1 100644--- a/dashboard/src/pages/MessageTester.css+++ b/dashboard/src/pages/MessageTester.css@@ -40,7 +40,8 @@margin-bottom: 1.25rem;}-.message-tester .form-group label {+.message-tester .form-group label,+.message-tester .form-group > .group-label {display: block;font-size: 0.7rem;font-weight: 700;diff --git a/dashboard/src/pages/MessageTester.tsx b/dashboard/src/pages/MessageTester.tsxindex bd74c2c31..8079d2c7f 100644--- a/dashboard/src/pages/MessageTester.tsx+++ b/dashboard/src/pages/MessageTester.tsx@@ -460,15 +460,23 @@ export function MessageTester() {{messageType !== 'bulk' && (<><div className="form-group">- <label>{t('messageTester.recipientType')}</label>- <div className="toggle-group">+ {/* A caption, not a label: it names the group, and there is no single control to bind+ it to. The buttons are exclusive choices, so each reports its own pressed state. */}+ <span className="group-label" id="recipient-type-label">+ {t('messageTester.recipientType')}+ </span>+ <div className="toggle-group" role="group" aria-labelledby="recipient-type-label"><button+ type="button"+ aria-pressed={recipientType === 'personal'}className={recipientType === 'personal' ? 'active' : ''}onClick={() => setRecipientType('personal')}>{t('messageTester.personal')}</button><button+ type="button"+ aria-pressed={recipientType === 'group'}className={recipientType === 'group' ? 'active' : ''}onClick={() => setRecipientType('group')}>@@ -517,11 +525,15 @@ export function MessageTester() {)}<div className="form-group">- <label>{t('messageTester.messageType')}</label>- <div className="toggle-group toggle-group-wrap">+ <span className="group-label" id="message-type-label">+ {t('messageTester.messageType')}+ </span>+ <div className="toggle-group toggle-group-wrap" role="group" aria-labelledby="message-type-label">{messageTypes.map(type => (<buttonkey={type}+ type="button"+ aria-pressed={messageType === type}className={messageType === type ? 'active' : ''}onClick={() => {// A picked file's mimetype is bound to the category active at pick time, so dropping thediff --git a/dashboard/src/pages/Plugins.css b/dashboard/src/pages/Plugins.cssindex 58e9c3d08..5319366c0 100644--- a/dashboard/src/pages/Plugins.css+++ b/dashboard/src/pages/Plugins.css@@ -399,7 +399,8 @@margin-bottom: 1.25rem;}-.plugins-page .config-form .config-array > label {+.plugins-page .config-form .config-array > label,+.plugins-page .config-form .config-array > .config-array-label {display: block;font-size: 0.875rem;font-weight: 600;diff --git a/dashboard/src/pages/Plugins.tsx b/dashboard/src/pages/Plugins.tsxindex 97a06fcef..6aa19181a 100644--- a/dashboard/src/pages/Plugins.tsx+++ b/dashboard/src/pages/Plugins.tsx@@ -70,12 +70,22 @@ function ConfigField({// first checkbox. useId is stable across re-renders and unique per instance.const fieldId = React.useId();const desc = field.description ? <small>{field.description}</small> : null;+ // Bound to the control it names. The boolean branch below builds its own pair because its caption+ // and its checkbox sit in different containers.const labelEl = (- <label>+ <label htmlFor={fieldId}>{label}{field.required && <span className="required-mark"> *</span>}</label>);+ // An array renders one control PER ROW, so there is no single input for a label to point at; a+ // `<label>` here would be an orphan that names nothing. It is a caption, so it is marked up as one.+ const captionEl = (+ <span className="config-array-label">+ {label}+ {field.required && <span className="required-mark"> *</span>}+ </span>+ );if (field.type === 'boolean') {return (@@ -98,6 +108,7 @@ function ConfigField({<div className="form-group">{labelEl}<select+ id={fieldId}value={String(value ?? '')}// Restore the option's original type (e.g. a number/boolean enum), not the raw string value.onChange={e => onChange(options.find(o => String(o) === e.target.value) ?? e.target.value)}@@ -141,14 +152,14 @@ function ConfigField({// that would stringify the array to "[object Object]"/"" and corrupt it).return (<div className="config-array">- {labelEl}+ {captionEl}{desc}</div>);}return (<div className="config-array">- {labelEl}+ {captionEl}{desc}{rows.map((row, i) => (<div className="config-array-row" key={i}>@@ -183,6 +194,7 @@ function ConfigField({<div className="form-group">{labelEl}<textarea+ id={fieldId}value={value === undefined || value === null ? '' : String(value)}placeholder={field.default !== undefined ? String(field.default) : undefined}required={field.required}@@ -201,6 +213,7 @@ function ConfigField({<div className="form-group">{labelEl}<input+ id={fieldId}type={inputType}value={value === undefined || value === null ? '' : String(value)}placeholder={field.default !== undefined ? String(field.default) : undefined}diff --git a/dashboard/src/pages/Sessions.tsx b/dashboard/src/pages/Sessions.tsxindex 1ba8e3651..6d940daf3 100644--- a/dashboard/src/pages/Sessions.tsx+++ b/dashboard/src/pages/Sessions.tsx@@ -674,10 +674,13 @@ export function Sessions() {{sessionConfig && (<div className="detail-item detail-item-toggle"><div className="detail-toggle-row">- <span className="detail-label">{t('sessions.details.autoRejectCalls')}</span>+ <span className="detail-label" id="auto-reject-calls-label">+ {t('sessions.details.autoRejectCalls')}+ </span><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="auto-reject-calls-label"checked={sessionConfig.autoRejectCalls}disabled={!canWrite || savingConfig}onChange={e => void handleAutoRejectToggle(e.target.checked)}diff --git a/dashboard/src/pages/Webhooks.tsx b/dashboard/src/pages/Webhooks.tsxindex bb9901989..6a9131b32 100644--- a/dashboard/src/pages/Webhooks.tsx+++ b/dashboard/src/pages/Webhooks.tsx@@ -406,10 +406,13 @@ export function Webhooks() {/>)}<div className="toggle-group">- <span className="toggle-label">{t('common.status')}</span>+ <span className="toggle-label" id="webhook-active-label">+ {t('common.status')}+ </span><label className="toggle-switch"><inputtype="checkbox"+ aria-labelledby="webhook-active-label"checked={editWebhook.active}onChange={e => setEditWebhook({ ...editWebhook, active: e.target.checked })}/>