Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(sidebar): 状态菜单专用 aria 与键盘焦点环

KingSystemHaiGo90aa27b91bc8
diff --git a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
index 37090bc0b1..d114ead237 100644
--- a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
@@ -77,6 +77,17 @@ describe('Mixed main list (sidebar-redesign D 期)', () => {
expect(sidebarSource).toContain('onStatusChange={filter.setStatus}');
});
+ it('keeps DialogueStatusMenu status-only for AT and shows a keyboard focus ring', () => {
+ expect(dialogueStatusMenuSource).toContain("'ccAgent.sidebar.dialogueStatusFilterAria'");
+ expect(dialogueStatusMenuSource).not.toContain('sortByLabel');
+ expect(dialogueStatusMenuSource).toContain('focus-visible:ring-[var(--focus-ring)]');
+ expect(projectsSectionSource).not.toContain('sortByLabel');
+ expect(projectsSectionSource).not.toContain(
+ 'buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground focus:outline-none"',
+ );
+ expect(sidebarSource).not.toContain('sortByLabel={t(`ccAgent.sidebar.dialogueSort.${dialogueSortBy}`)}');
+ });
+
it('drops the removed date-grouped section entirely', () => {
expect(sidebarSource).not.toContain('<DateGroupedSessionsSection');
expect(sidebarSource).not.toContain("filter.groupBy === 'date'");
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
index 2ee7e8e9dc..6d29925e18 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx
@@ -4371,7 +4371,6 @@ function RailPanels({
<DialogueStatusMenu
status={status}
onStatusChange={onStatusChange}
- sortByLabel={t(`ccAgent.sidebar.dialogueSort.${dialogueSortBy}`)}
buttonClassName="h-6 w-6 -my-1 text-[var(--text-tertiary)] hover:text-[var(--text-secondary)]"
iconSize={14}
/>
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx
index 6767954d16..8f64493d45 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/DialogueStatusMenu.tsx
@@ -4,6 +4,9 @@
* 全局 Status 仍由 SidebarFilterPopover 持有;本组件复用同一份
* filter.status / setStatus,把「活跃 / 已归档 / 全部」放到混排「对话」组头
* 和折叠 rail 对话面板上,避免入口只活在未挂载的 DialogueSection 里。
+ *
+ * 本菜单只有状态选项、没有排序项,可访问名称只用状态,不把状态文案填进
+ * `dialogueSettingsAria` 的 {{sortBy}} 占位符。
*/
import { Check, SlidersHorizontal } from 'lucide-react';
@@ -29,18 +32,18 @@ export const DIALOGUE_STATUS_OPTIONS: ReadonlyArray<{
{ value: 'all', labelKey: 'ccAgent.sidebar.filterStatus.all' },
];
+const STATUS_BUTTON_FOCUS =
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]';
+
export function DialogueStatusMenu({
status,
onStatusChange,
- sortByLabel,
buttonClassName,
iconSize = 14,
stopRowToggle = false,
}: {
status: FilterStatus;
onStatusChange: (status: FilterStatus) => void;
- /** 与 i18n `dialogueSettingsAria` 的 {{sortBy}} 对齐;省略时复用状态文案。 */
- sortByLabel?: string;
buttonClassName?: string;
iconSize?: number;
/** 组头整行可点折叠时,阻止菜单点击冒泡成收起/展开。 */
@@ -61,9 +64,8 @@ export function DialogueStatusMenu({
<Tip text={t('ccAgent.sidebar.dialogueSettings')} side="bottom">
<button
type="button"
- aria-label={t('ccAgent.sidebar.dialogueSettingsAria', {
+ aria-label={t('ccAgent.sidebar.dialogueStatusFilterAria', {
status: statusLabel,
- sortBy: sortByLabel ?? statusLabel,
})}
onClick={stop}
onPointerDown={stop}
@@ -72,6 +74,7 @@ export function DialogueStatusMenu({
'flex shrink-0 items-center justify-center rounded-md',
'text-[var(--sidebar-list-muted)]',
'transition-colors hover:text-[var(--sidebar-nav-text)]',
+ STATUS_BUTTON_FOCUS,
buttonClassName,
)}
>
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index d9d9383352..7a5c5e15ef 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -1311,7 +1311,7 @@ function SessionGroupNode({
<DialogueStatusMenu
status={status}
onStatusChange={onStatusChange}
- buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground focus:outline-none"
+ buttonClassName="size-5 hover:bg-sidebar-item-hover hover:text-foreground"
iconSize={14}
stopRowToggle
/>
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index 5f10aef31b..3c316297c7 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -9332,6 +9332,7 @@
"noDialogues": "No sessions",
"dialogueSettings": "Organize Chat",
"dialogueSettingsAria": "Organize Chat (Status: {{status}}, Sort by: {{sortBy}})",
+ "dialogueStatusFilterAria": "Filter Chat status: {{status}}",
"dialogueSortHeading": "Sort by",
"dialogueSort": {
"recency": "Recent first",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index cf89ffbc90..4bf0f45719 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -9317,6 +9317,7 @@
"noDialogues": "セッションはありません",
"dialogueSettings": "会話を整理",
"dialogueSettingsAria": "会話を整理(状態:{{status}}、並び替え:{{sortBy}})",
+ "dialogueStatusFilterAria": "会話の状態を絞り込む:{{status}}",
"dialogueSortHeading": "並び替え",
"dialogueSort": {
"recency": "新しい順",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 2d3e249886..a39ef9d799 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -9317,6 +9317,7 @@
"noDialogues": "세션 없음",
"dialogueSettings": "대화 정리",
"dialogueSettingsAria": "대화 정리(상태: {{status}}, 정렬: {{sortBy}})",
+ "dialogueStatusFilterAria": "대화 상태 필터: {{status}}",
"dialogueSortHeading": "정렬",
"dialogueSort": {
"recency": "최근순",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index afca7a2c92..c7a6ff1cd7 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -9317,6 +9317,7 @@
"noDialogues": "暂无任务",
"dialogueSettings": "整理对话",
"dialogueSettingsAria": "整理对话(状态:{{status}},排序:{{sortBy}})",
+ "dialogueStatusFilterAria": "筛选对话状态:{{status}}",
"dialogueSortHeading": "排序",
"dialogueSort": {
"recency": "最近优先",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index 1db289b33d..90750912b9 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -9317,6 +9317,7 @@
"noDialogues": "暫無任務",
"dialogueSettings": "整理對話",
"dialogueSettingsAria": "整理對話(狀態:{{status}},排序:{{sortBy}})",
+ "dialogueStatusFilterAria": "篩選對話狀態:{{status}}",
"dialogueSortHeading": "排序",
"dialogueSort": {
"recency": "最近優先",