Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): name every remaining native control

Yudhi Armyndharisf508f5d627ac
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90218a41c..e0840a9db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- The filter builder's three selects, the status image picker and the templates session picker expose accessible names, so a screen reader no longer announces unnamed comboboxes on those surfaces.
- The plugin session picker exposes an accessible name, and a required array field's asterisk renders in the error colour. The caption lives outside `.form-group`, so the rule that colours the mark never matched it.
- Baileys forwards `mentions` on an audio send. The route accepts the field and whatsapp-web.js sent it, so the same request tagged group participants on one engine and silently did not on the other.
- Forwarding a message whose id is not in `fromChatId` is refused on Baileys with the same `404` whatsapp-web.js already answered. The parameter was accepted and then ignored, so any stored id forwarded from any claimed source.
diff --git a/dashboard/src/a11y-controls.test.ts b/dashboard/src/a11y-controls.test.ts
index 70d70d9a0..4b0fcc1ed 100644
--- a/dashboard/src/a11y-controls.test.ts
+++ b/dashboard/src/a11y-controls.test.ts
@@ -331,3 +331,61 @@ test('every ConfigField caption is bound, and every single control carries the p
assert.ok(controls >= 4, `expected ConfigField to render controls, found ${controls}`);
assert.deepEqual(problems, [], problems.join('\n'));
});
+
+/**
+ * The three cases above cover the patterns this dashboard invented. This one covers the ordinary
+ * ones: a bare `<select>` or `<input>` whose caption is a sibling rather than a label gets no
+ * accessible name either, and nothing here was watching for it. Seven shipped that way.
+ *
+ * A control is considered named by aria-label, aria-labelledby, an id some label points at, an
+ * enclosing <label> (which names it through its own text), or a placeholder. Placeholder is accepted
+ * because it does produce a name, while noting it is a weak one: it disappears on input and WCAG
+ * does not treat it as a label substitute.
+ *
+ * `display: none` controls are exempt and must say so: the file inputs behind an upload button are
+ * never reached by assistive tech, and the button carries the name.
+ */
+test('every native control is named, or is hidden from assistive tech', () => {
+ const unnamed: string[] = [];
+ let checked = 0;
+
+ for (const { file, source } of pages()) {
+ const all = jsxElements(source);
+ const labelTargets = new Set(all.map(n => attrText(n, 'htmlFor')).filter((v): v is string => v !== undefined));
+
+ for (const node of all) {
+ const tag = tagName(node);
+ if (tag !== 'input' && tag !== 'select' && tag !== 'textarea') continue;
+ const type = literalAttr(node, 'type');
+ if (type === 'hidden' || type === 'submit' || type === 'button') continue;
+
+ // Not rendered to anyone, so it has no name to give; the trigger button carries it.
+ const opening = ts.isJsxElement(node) ? node.openingElement : node;
+ if (/display:\s*'none'/.test(opening.getText())) continue;
+
+ checked++;
+ const id = attrText(node, 'id');
+ const named =
+ attr(node, 'aria-label') !== undefined ||
+ attr(node, 'aria-labelledby') !== undefined ||
+ attr(node, 'placeholder') !== undefined ||
+ (id !== undefined && labelTargets.has(id));
+ if (named) continue;
+
+ // A wrapping <label> names it through its own text.
+ let parent: ts.Node | undefined = node.parent;
+ let wrapped = false;
+ while (parent) {
+ if (ts.isJsxElement(parent) && parent.openingElement.tagName.getText() === 'label') {
+ wrapped = true;
+ break;
+ }
+ parent = parent.parent;
+ }
+ if (!wrapped) unnamed.push(`${file}:${line(source, node)} <${tag}>`);
+ }
+ }
+
+ assert.ok(checked >= 80, `expected the dashboard to declare native controls, found ${checked}`);
+ assert.deepEqual(unnamed, [], unnamed.join('\n'));
+});
diff --git a/dashboard/src/components/FilterBuilder.tsx b/dashboard/src/components/FilterBuilder.tsx
index 134ddaff3..9c982f1b7 100644
--- a/dashboard/src/components/FilterBuilder.tsx
+++ b/dashboard/src/components/FilterBuilder.tsx
@@ -173,7 +173,12 @@ export function FilterBuilder({ filters, onChange, chats }: FilterBuilderProps)
const def = descriptorFor(condition.field);
return (
<div key={index} className="filter-row">
- <select className="filter-field" value={condition.field} onChange={e => changeField(index, e.target.value)}>
+ <select
+ className="filter-field"
+ aria-label={t('webhooks.filters.fieldLabel')}
+ value={condition.field}
+ onChange={e => changeField(index, e.target.value)}
+ >
{MESSAGE_FIELDS.map(f => (
<option key={f.field} value={f.field}>
{t(`webhooks.filters.fields.${f.field}`)}
@@ -183,6 +188,7 @@ export function FilterBuilder({ filters, onChange, chats }: FilterBuilderProps)
<select
className="filter-operator"
+ aria-label={t('webhooks.filters.operatorLabel')}
value={condition.operator}
onChange={e => updateAt(index, { operator: e.target.value as WebhookFilterOperator })}
>
@@ -247,6 +253,7 @@ export function FilterBuilder({ filters, onChange, chats }: FilterBuilderProps)
{def.kind === 'boolean' && (
<select
className="filter-bool"
+ aria-label={t('webhooks.filters.valueLabel')}
value={condition.value === true ? 'true' : 'false'}
onChange={e => updateAt(index, { value: e.target.value === 'true' })}
>
diff --git a/dashboard/src/components/chats/StatusComposeModal.tsx b/dashboard/src/components/chats/StatusComposeModal.tsx
index 11aaf54e4..2e435b3ab 100644
--- a/dashboard/src/components/chats/StatusComposeModal.tsx
+++ b/dashboard/src/components/chats/StatusComposeModal.tsx
@@ -233,7 +233,13 @@ function StatusComposeModal({ sessionId, onClose, onPosted }: Props) {
</div>
<p className="compose-image-or">{t('chats.status.orLabel')}</p>
<div className="compose-field">
- <input type="file" accept="image/*" ref={composeFileInputRef} onChange={handleComposeImageFile} />
+ <input
+ type="file"
+ accept="image/*"
+ aria-label={t('chats.status.imageFile')}
+ ref={composeFileInputRef}
+ onChange={handleComposeImageFile}
+ />
</div>
<div className="compose-field">
<label htmlFor="scm-5">{t('chats.status.caption')}</label>
diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.json
index 43491d162..7597d92fd 100644
--- a/dashboard/src/i18n/locales/ar.json
+++ b/dashboard/src/i18n/locales/ar.json
@@ -150,7 +150,8 @@
"orLabel": "أو",
"post": "نشر",
"posted": "تم نشر الحالة",
- "postFailed": "تعذر نشر الحالة"
+ "postFailed": "تعذر نشر الحالة",
+ "imageFile": "صورة الحالة"
},
"channels": {
"notSupported": "القنوات غير مدعومة على محرك Baileys.",
@@ -428,7 +429,10 @@
"isNot": "ليس",
"contains": "يحتوي على",
"equals": "يساوي"
- }
+ },
+ "fieldLabel": "حقل التصفية",
+ "operatorLabel": "عامل التصفية",
+ "valueLabel": "قيمة التصفية"
},
"columns": {
"url": "الرابط",
@@ -509,7 +513,8 @@
"deleted": "تم حذف القالب بنجاح",
"deleteFailed": "فشل حذف القالب: {{message}}",
"copied": "تم نسخ اسم القالب"
- }
+ },
+ "sessionSelect": "الجلسة"
},
"apiKeys": {
"title": "مفاتيح API",
diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.json
index 175579ff3..a4f9ed7a8 100644
--- a/dashboard/src/i18n/locales/de.json
+++ b/dashboard/src/i18n/locales/de.json
@@ -142,7 +142,8 @@
"orLabel": "oder",
"post": "Posten",
"posted": "Status gepostet",
- "postFailed": "Status konnte nicht gepostet werden"
+ "postFailed": "Status konnte nicht gepostet werden",
+ "imageFile": "Statusbild"
},
"channels": {
"notSupported": "Kanäle werden von der Baileys-Engine nicht unterstützt.",
@@ -413,7 +414,10 @@
"isNot": "ist nicht",
"contains": "enthält",
"equals": "entspricht"
- }
+ },
+ "fieldLabel": "Filterfeld",
+ "operatorLabel": "Filteroperator",
+ "valueLabel": "Filterwert"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "Vorlage wurde erfolgreich gelöscht",
"deleteFailed": "Vorlage konnte nicht gelöscht werden: {{message}}",
"copied": "Vorlagenname wurde kopiert"
- }
+ },
+ "sessionSelect": "Sitzung"
},
"apiKeys": {
"title": "API-Schlüssel",
diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.json
index 9eab3b7f7..f8bbed2ec 100644
--- a/dashboard/src/i18n/locales/en.json
+++ b/dashboard/src/i18n/locales/en.json
@@ -142,7 +142,8 @@
"orLabel": "or",
"post": "Post",
"posted": "Status posted",
- "postFailed": "Could not post the status"
+ "postFailed": "Could not post the status",
+ "imageFile": "Status image"
},
"channels": {
"notSupported": "Channels are not supported on the Baileys engine.",
@@ -413,7 +414,10 @@
"isNot": "is not",
"contains": "contains",
"equals": "equals"
- }
+ },
+ "fieldLabel": "Filter field",
+ "operatorLabel": "Filter operator",
+ "valueLabel": "Filter value"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "Template deleted successfully",
"deleteFailed": "Failed to delete template: {{message}}",
"copied": "Template name copied"
- }
+ },
+ "sessionSelect": "Session"
},
"apiKeys": {
"title": "API Keys",
diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.json
index 71eff4c86..7c06b1e20 100644
--- a/dashboard/src/i18n/locales/es.json
+++ b/dashboard/src/i18n/locales/es.json
@@ -142,7 +142,8 @@
"orLabel": "o",
"post": "Publicar",
"posted": "Estado publicado",
- "postFailed": "No se pudo publicar el estado"
+ "postFailed": "No se pudo publicar el estado",
+ "imageFile": "Imagen de estado"
},
"channels": {
"notSupported": "Los canales no son compatibles con el motor Baileys.",
@@ -413,7 +414,10 @@
"isNot": "no es",
"contains": "contiene",
"equals": "es igual a"
- }
+ },
+ "fieldLabel": "Campo de filtro",
+ "operatorLabel": "Operador de filtro",
+ "valueLabel": "Valor de filtro"
},
"columns": {
"url": "URL",
@@ -668,7 +672,8 @@
"deleted": "Plantilla eliminada correctamente",
"deleteFailed": "Error al eliminar la plantilla: {{message}}",
"copied": "Nombre de plantilla copiado"
- }
+ },
+ "sessionSelect": "Sesión"
},
"infrastructure": {
"title": "Infraestructura",
diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.json
index df2abd571..0e5ab7753 100644
--- a/dashboard/src/i18n/locales/fr.json
+++ b/dashboard/src/i18n/locales/fr.json
@@ -142,7 +142,8 @@
"orLabel": "ou",
"post": "Publier",
"posted": "Statut publié",
- "postFailed": "Impossible de publier le statut"
+ "postFailed": "Impossible de publier le statut",
+ "imageFile": "Image de statut"
},
"channels": {
"notSupported": "Les chaînes ne sont pas prises en charge par le moteur Baileys.",
@@ -413,7 +414,10 @@
"isNot": "n'est pas",
"contains": "contient",
"equals": "est égal à"
- }
+ },
+ "fieldLabel": "Champ de filtre",
+ "operatorLabel": "Opérateur de filtre",
+ "valueLabel": "Valeur de filtre"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "Template supprimé avec succès",
"deleteFailed": "Échec de la suppression du template : {{message}}",
"copied": "Nom du template copié"
- }
+ },
+ "sessionSelect": "Session"
},
"apiKeys": {
"title": "Clés API",
diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.json
index 4d3a761e5..9b8372189 100644
--- a/dashboard/src/i18n/locales/he.json
+++ b/dashboard/src/i18n/locales/he.json
@@ -147,7 +147,8 @@
"orLabel": "או",
"post": "פרסם",
"posted": "הסטטוס פורסם",
- "postFailed": "לא ניתן היה לפרסם את הסטטוס"
+ "postFailed": "לא ניתן היה לפרסם את הסטטוס",
+ "imageFile": "תמונת סטטוס"
},
"channels": {
"notSupported": "ערוצים אינם נתמכים במנוע Baileys.",
@@ -422,7 +423,10 @@
"isNot": "אינו",
"contains": "מכיל",
"equals": "שווה ל"
- }
+ },
+ "fieldLabel": "שדה סינון",
+ "operatorLabel": "אופרטור סינון",
+ "valueLabel": "ערך סינון"
},
"columns": {
"url": "כתובת URL",
@@ -503,7 +507,8 @@
"deleted": "התבנית נמחקה בהצלחה",
"deleteFailed": "מחיקת התבנית נכשלה: {{message}}",
"copied": "שם התבנית הועתק"
- }
+ },
+ "sessionSelect": "Session"
},
"apiKeys": {
"title": "מפתחות API",
diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.json
index 171fa641a..718e6834a 100644
--- a/dashboard/src/i18n/locales/it.json
+++ b/dashboard/src/i18n/locales/it.json
@@ -142,7 +142,8 @@
"orLabel": "o",
"post": "Pubblica",
"posted": "Stato pubblicato",
- "postFailed": "Impossibile pubblicare lo stato"
+ "postFailed": "Impossibile pubblicare lo stato",
+ "imageFile": "Immagine di stato"
},
"channels": {
"notSupported": "I canali non sono supportati sul motore Baileys.",
@@ -413,7 +414,10 @@
"isNot": "non è",
"contains": "contiene",
"equals": "è uguale a"
- }
+ },
+ "fieldLabel": "Campo filtro",
+ "operatorLabel": "Operatore filtro",
+ "valueLabel": "Valore filtro"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "Modello eliminato con successo",
"deleteFailed": "Impossibile eliminare il modello: {{message}}",
"copied": "Nome del modello copiato"
- }
+ },
+ "sessionSelect": "Sessione"
},
"apiKeys": {
"title": "Chiavi API",
diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.json
index 2bd28e479..59a6c6beb 100644
--- a/dashboard/src/i18n/locales/ko.json
+++ b/dashboard/src/i18n/locales/ko.json
@@ -142,7 +142,8 @@
"orLabel": "또는",
"post": "게시",
"posted": "상태가 게시되었습니다",
- "postFailed": "상태를 게시할 수 없습니다"
+ "postFailed": "상태를 게시할 수 없습니다",
+ "imageFile": "상태 이미지"
},
"channels": {
"notSupported": "Baileys 엔진에서는 채널을 지원하지 않습니다.",
@@ -413,7 +414,10 @@
"isNot": "다음과 같지 않음",
"contains": "포함",
"equals": "동일함"
- }
+ },
+ "fieldLabel": "필터 필드",
+ "operatorLabel": "필터 연산자",
+ "valueLabel": "필터 값"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "템플릿이 삭제되었습니다",
"deleteFailed": "템플릿 삭제 실패: {{message}}",
"copied": "템플릿 이름이 복사되었습니다"
- }
+ },
+ "sessionSelect": "세션"
},
"apiKeys": {
"title": "API 키",
diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.json
index 1714678dd..9ff641ab0 100644
--- a/dashboard/src/i18n/locales/pt-BR.json
+++ b/dashboard/src/i18n/locales/pt-BR.json
@@ -142,7 +142,8 @@
"orLabel": "ou",
"post": "Publicar",
"posted": "Status publicado",
- "postFailed": "Não foi possível publicar o status"
+ "postFailed": "Não foi possível publicar o status",
+ "imageFile": "Imagem do status"
},
"channels": {
"notSupported": "Os canais não são compatíveis com o mecanismo Baileys.",
@@ -413,7 +414,10 @@
"isNot": "não é",
"contains": "contém",
"equals": "é igual a"
- }
+ },
+ "fieldLabel": "Campo do filtro",
+ "operatorLabel": "Operador do filtro",
+ "valueLabel": "Valor do filtro"
},
"columns": {
"url": "URL",
@@ -668,7 +672,8 @@
"deleted": "Modelo excluído com sucesso",
"deleteFailed": "Erro ao excluir o modelo: {{message}}",
"copied": "Nome do modelo copiado"
- }
+ },
+ "sessionSelect": "Sessão"
},
"infrastructure": {
"title": "Infraestrutura",
diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.json
index 9fa3b31eb..888d5568e 100644
--- a/dashboard/src/i18n/locales/te.json
+++ b/dashboard/src/i18n/locales/te.json
@@ -142,7 +142,8 @@
"orLabel": "or",
"post": "Post",
"posted": "Status posted",
- "postFailed": "Could not post the status"
+ "postFailed": "Could not post the status",
+ "imageFile": "స్టేటస్ చిత్రం"
},
"channels": {
"notSupported": "Channels are not supported on the Baileys engine.",
@@ -413,7 +414,10 @@
"isNot": "కాదు",
"contains": "కలిగి ఉంది",
"equals": "సమానం"
- }
+ },
+ "fieldLabel": "ఫిల్టర్ ఫీల్డ్",
+ "operatorLabel": "ఫిల్టర్ ఆపరేటర్",
+ "valueLabel": "ఫిల్టర్ విలువ"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "టెంప్లేట్ విజయవంతంగా తొలగించబడింది",
"deleteFailed": "టెంప్లేట్ తొలగించడం విఫలమైంది: {{message}}",
"copied": "టెంప్లేట్ పేరు కాపీ చేయబడింది"
- }
+ },
+ "sessionSelect": "సెషన్"
},
"apiKeys": {
"title": "API కీలు",
diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.json
index ecf5ec613..015a663fb 100644
--- a/dashboard/src/i18n/locales/tr.json
+++ b/dashboard/src/i18n/locales/tr.json
@@ -142,7 +142,8 @@
"orLabel": "veya",
"post": "Paylaş",
"posted": "Durum paylaşıldı",
- "postFailed": "Durum paylaşılamadı"
+ "postFailed": "Durum paylaşılamadı",
+ "imageFile": "Durum görseli"
},
"channels": {
"notSupported": "Kanallar Baileys motorunda desteklenmemektedir.",
@@ -413,7 +414,10 @@
"isNot": "eşit değildir",
"contains": "içerir",
"equals": "tam eşleşir"
- }
+ },
+ "fieldLabel": "Filtre alanı",
+ "operatorLabel": "Filtre operatörü",
+ "valueLabel": "Filtre değeri"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "Şablon başarıyla silindi",
"deleteFailed": "Şablon silinemedi: {{message}}",
"copied": "Şablon adı kopyalandı"
- }
+ },
+ "sessionSelect": "Oturum"
},
"apiKeys": {
"title": "API Anahtarları",
diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.json
index fa392943b..087ec5c3c 100644
--- a/dashboard/src/i18n/locales/zh-CN.json
+++ b/dashboard/src/i18n/locales/zh-CN.json
@@ -142,7 +142,8 @@
"orLabel": "或",
"post": "发布",
"posted": "状态已发布",
- "postFailed": "无法发布状态"
+ "postFailed": "无法发布状态",
+ "imageFile": "状态图片"
},
"channels": {
"notSupported": "Baileys 引擎不支持频道。",
@@ -413,7 +414,10 @@
"isNot": "不是",
"contains": "包含",
"equals": "等于"
- }
+ },
+ "fieldLabel": "筛选字段",
+ "operatorLabel": "筛选运算符",
+ "valueLabel": "筛选值"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "模板删除成功",
"deleteFailed": "删除模板失败:{{message}}",
"copied": "已复制模板名称"
- }
+ },
+ "sessionSelect": "会话"
},
"apiKeys": {
"title": "API 密钥",
diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.json
index ccefd5b3c..832075e3e 100644
--- a/dashboard/src/i18n/locales/zh-HK.json
+++ b/dashboard/src/i18n/locales/zh-HK.json
@@ -142,7 +142,8 @@
"orLabel": "或",
"post": "發佈",
"posted": "狀態已發佈",
- "postFailed": "無法發佈狀態"
+ "postFailed": "無法發佈狀態",
+ "imageFile": "狀態圖片"
},
"channels": {
"notSupported": "Baileys 引擎不支援頻道。",
@@ -413,7 +414,10 @@
"isNot": "不是",
"contains": "包含",
"equals": "等於"
- }
+ },
+ "fieldLabel": "篩選欄位",
+ "operatorLabel": "篩選運算符",
+ "valueLabel": "篩選值"
},
"columns": {
"url": "URL",
@@ -494,7 +498,8 @@
"deleted": "範本刪除成功",
"deleteFailed": "刪除範本失敗:{{message}}",
"copied": "已複製範本名稱"
- }
+ },
+ "sessionSelect": "工作階段"
},
"apiKeys": {
"title": "API 金鑰",
diff --git a/dashboard/src/pages/Templates.tsx b/dashboard/src/pages/Templates.tsx
index 93f3ad02b..d87cf485f 100644
--- a/dashboard/src/pages/Templates.tsx
+++ b/dashboard/src/pages/Templates.tsx
@@ -186,6 +186,7 @@ export function Templates() {
actions={
<select
className="templates-session-select"
+ aria-label={t('templates.sessionSelect')}
value={selectedSessionId}
onChange={event => {
setSelectedSessionId(event.target.value);