Skip to content

Build and run agents you can see, understand and trust.

fix(webui): add dialog descriptions for accessibility (#1771)

Xinmin Zengda0ffb15ae56
diff --git a/examples/web_ui/frontend/src/components/dialog/AgentDialog.tsx b/examples/web_ui/frontend/src/components/dialog/AgentDialog.tsx
index cd62a3e41..de77fdddc 100644
--- a/examples/web_ui/frontend/src/components/dialog/AgentDialog.tsx
+++ b/examples/web_ui/frontend/src/components/dialog/AgentDialog.tsx
@@ -17,6 +17,7 @@ import {
DialogFooter,
DialogHeader,
DialogTitle,
+ DialogDescription,
DialogTrigger,
} from '@/components/ui/dialog';
import { useAgents } from '@/hooks/useAgents';
@@ -80,6 +81,9 @@ export function AgentDialog({ onCreated, triggerId }: Props) {
<DialogContent className="!w-[500px] !max-w-[500px]">
<DialogHeader>
<DialogTitle>{t('dialog-agent-create.title')}</DialogTitle>
+ <DialogDescription className="sr-only">
+ {t('dialog-agent-create.description')}
+ </DialogDescription>
</DialogHeader>
<div className="no-scrollbar -mx-4 max-h-[75vh] overflow-y-auto px-4">
{schema && values ? (
diff --git a/examples/web_ui/frontend/src/components/dialog/CreateCredentialDialog.tsx b/examples/web_ui/frontend/src/components/dialog/CreateCredentialDialog.tsx
index 330db5f44..e76b7d521 100644
--- a/examples/web_ui/frontend/src/components/dialog/CreateCredentialDialog.tsx
+++ b/examples/web_ui/frontend/src/components/dialog/CreateCredentialDialog.tsx
@@ -10,6 +10,7 @@ import {
DialogContent,
DialogHeader,
DialogTitle,
+ DialogDescription,
DialogFooter,
} from '@/components/ui/dialog';
import { Field, FieldGroup, FieldLabel } from '@/components/ui/field.tsx';
@@ -86,6 +87,9 @@ export function CreateCredentialDialog({ open, onOpenChange, onCreated, defaultT
<DialogContent className="!w-[500px] !max-w-[500px]">
<DialogHeader>
<DialogTitle>{t('dialog-credential-create.title')}</DialogTitle>
+ <DialogDescription>
+ {t('dialog-credential-create.description')}
+ </DialogDescription>
</DialogHeader>
<FieldGroup>
<Field>
diff --git a/examples/web_ui/frontend/src/components/dialog/EditAgentDialog.tsx b/examples/web_ui/frontend/src/components/dialog/EditAgentDialog.tsx
index 96c169cd8..48b9e52c6 100644
--- a/examples/web_ui/frontend/src/components/dialog/EditAgentDialog.tsx
+++ b/examples/web_ui/frontend/src/components/dialog/EditAgentDialog.tsx
@@ -17,6 +17,7 @@ import {
DialogFooter,
DialogHeader,
DialogTitle,
+ DialogDescription,
} from '@/components/ui/dialog';
import { useAgents } from '@/hooks/useAgents';
import { useAgentSchema } from '@/hooks/useAgentSchema';
@@ -87,6 +88,9 @@ export function EditAgentDialog({ open, onOpenChange, agent, onUpdated }: Props)
<DialogContent className="!w-[500px] !max-w-[500px]">
<DialogHeader>
<DialogTitle>{t('dialog-agent-edit.title')}</DialogTitle>
+ <DialogDescription className="sr-only">
+ {t('dialog-agent-edit.description')}
+ </DialogDescription>
</DialogHeader>
<div className="no-scrollbar -mx-4 max-h-[75vh] overflow-y-auto px-4">
{schema && values ? (
diff --git a/examples/web_ui/frontend/src/components/dialog/EditCredentialDialog.tsx b/examples/web_ui/frontend/src/components/dialog/EditCredentialDialog.tsx
index 687af8702..36f3e2702 100644
--- a/examples/web_ui/frontend/src/components/dialog/EditCredentialDialog.tsx
+++ b/examples/web_ui/frontend/src/components/dialog/EditCredentialDialog.tsx
@@ -10,6 +10,7 @@ import {
DialogContent,
DialogHeader,
DialogTitle,
+ DialogDescription,
DialogFooter,
} from '@/components/ui/dialog';
import { useCredentials } from '@/hooks/useCredentials';
@@ -82,6 +83,7 @@ export function EditCredentialDialog({ open, onOpenChange, credential, onUpdated
<DialogContent className="!w-[500px] !max-w-[500px]">
<DialogHeader>
<DialogTitle>{t('dialog-credential-edit.title')}</DialogTitle>
+ <DialogDescription>{t('dialog-credential-edit.description')}</DialogDescription>
</DialogHeader>
{loadingSchema ? (
<p className="text-muted-foreground text-sm">{t('common.loading')}</p>
diff --git a/examples/web_ui/frontend/src/components/dialog/RenameSessionDialog.tsx b/examples/web_ui/frontend/src/components/dialog/RenameSessionDialog.tsx
index b3b42f243..8bd906f75 100644
--- a/examples/web_ui/frontend/src/components/dialog/RenameSessionDialog.tsx
+++ b/examples/web_ui/frontend/src/components/dialog/RenameSessionDialog.tsx
@@ -8,6 +8,7 @@ import {
DialogFooter,
DialogHeader,
DialogTitle,
+ DialogDescription,
} from '@/components/ui/dialog';
import { Field, FieldGroup, FieldLabel } from '@/components/ui/field';
import { Input } from '@/components/ui/input';
@@ -45,6 +46,7 @@ export function RenameSessionDialog({ open, onOpenChange, currentName, onConfirm
<DialogContent>
<DialogHeader>
<DialogTitle>{t('dialog-session-rename.title')}</DialogTitle>
+ <DialogDescription>{t('dialog-session-rename.description')}</DialogDescription>
</DialogHeader>
<FieldGroup>
<Field>
diff --git a/examples/web_ui/frontend/src/i18n/locales/en.json b/examples/web_ui/frontend/src/i18n/locales/en.json
index 7f1345e55..ce3ba649d 100644
--- a/examples/web_ui/frontend/src/i18n/locales/en.json
+++ b/examples/web_ui/frontend/src/i18n/locales/en.json
@@ -106,6 +106,7 @@
},
"dialog-agent-create": {
"title": "Create agent",
+ "description": "Define a new agent's identity and behaviour.",
"trigger": "Create agent"
},
"agent-form": {
@@ -132,7 +133,8 @@
}
},
"dialog-agent-edit": {
- "title": "Edit agent"
+ "title": "Edit agent",
+ "description": "Update this agent's configuration."
},
"dialog-agent-delete": {
"entity": "agent",
@@ -144,6 +146,7 @@
},
"dialog-session-rename": {
"title": "Rename session",
+ "description": "Give this session a new name.",
"label": "Name",
"placeholder": "Session name"
},
@@ -153,11 +156,13 @@
},
"dialog-credential-create": {
"title": "Add credential",
+ "description": "Add credentials for a model provider.",
"selectType": "Provider",
"selectTypePlaceholder": "Select a provider"
},
"dialog-credential-edit": {
- "title": "Edit Credential"
+ "title": "Edit Credential",
+ "description": "Update the saved credential for this provider."
},
"credential": {
"addConfig": "Add configuration",
diff --git a/examples/web_ui/frontend/src/i18n/locales/zh.json b/examples/web_ui/frontend/src/i18n/locales/zh.json
index 1388d67ea..fee9dd65a 100644
--- a/examples/web_ui/frontend/src/i18n/locales/zh.json
+++ b/examples/web_ui/frontend/src/i18n/locales/zh.json
@@ -106,6 +106,7 @@
},
"dialog-agent-create": {
"title": "创建 Agent",
+ "description": "定义新 Agent 的身份与行为。",
"trigger": "创建 Agent"
},
"agent-form": {
@@ -132,7 +133,8 @@
}
},
"dialog-agent-edit": {
- "title": "编辑 Agent"
+ "title": "编辑 Agent",
+ "description": "更新此 Agent 的配置。"
},
"dialog-agent-delete": {
"entity": "Agent",
@@ -144,6 +146,7 @@
},
"dialog-session-rename": {
"title": "重命名会话",
+ "description": "为该会话设置新名称。",
"label": "名称",
"placeholder": "会话名称"
},
@@ -153,11 +156,13 @@
},
"dialog-credential-create": {
"title": "添加凭证",
+ "description": "为模型提供商添加凭证。",
"selectType": "提供商",
"selectTypePlaceholder": "选择提供商"
},
"dialog-credential-edit": {
- "title": "编辑凭证"
+ "title": "编辑凭证",
+ "description": "更新该提供商已保存的凭证。"
},
"credential": {
"addConfig": "添加配置",