Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🗣️ a11y: Add Screen Reader Context to Conversation Date Group Headings (#12340)
Danny Avila676d297cb47f
diff --git a/client/src/components/Conversations/Conversations.tsx b/client/src/components/Conversations/Conversations.tsxindex c7eb4d53ef..f55af35f10 100644--- a/client/src/components/Conversations/Conversations.tsx+++ b/client/src/components/Conversations/Conversations.tsx@@ -99,6 +99,9 @@ const DateLabel: FC<{ groupName: string; isFirst?: boolean }> = memo(({ groupNamconst localize = useLocalize();return (<h2+ aria-label={localize('com_a11y_chats_date_section', {+ date: localize(groupName as TranslationKeys) || groupName,+ })}className={cn('pl-1 pt-1 text-text-secondary', isFirst === true ? 'mt-0' : 'mt-2')}style={{ fontSize: '0.7rem' }}>@@ -394,4 +397,5 @@ const Conversations: FC<ConversationsProps> = ({);};+export { DateLabel };export default memo(Conversations);diff --git a/client/src/components/Conversations/__tests__/DateLabel.test.tsx b/client/src/components/Conversations/__tests__/DateLabel.test.tsxnew file mode 100644index 0000000000..ccd9bc4126--- /dev/null+++ b/client/src/components/Conversations/__tests__/DateLabel.test.tsx@@ -0,0 +1,55 @@+import React from 'react';+import { render, screen } from '@testing-library/react';+import '@testing-library/jest-dom/extend-expect';+import { DateLabel } from '../Conversations';++jest.mock('~/hooks', () => ({+ useLocalize: () => (key: string, params?: Record<string, string>) => {+ const translations: Record<string, string> = {+ com_a11y_chats_date_section: `Chats from ${params?.date ?? ''}`,+ com_ui_date_today: 'Today',+ com_ui_date_yesterday: 'Yesterday',+ com_ui_date_previous_7_days: 'Previous 7 days',+ };+ return translations[key] ?? key;+ },+}));++describe('DateLabel', () => {+ it('provides accessible heading name via aria-label', () => {+ render(<DateLabel groupName="com_ui_date_today" />);+ expect(screen.getByRole('heading', { level: 2, name: 'Chats from Today' })).toBeInTheDocument();+ });++ it('renders visible text as the localized group name', () => {+ render(<DateLabel groupName="com_ui_date_today" />);+ expect(screen.getByText('Today')).toBeInTheDocument();+ });++ it('sets aria-label with the full accessible phrase', () => {+ const { container } = render(<DateLabel groupName="com_ui_date_yesterday" />);+ const heading = container.querySelector('h2');+ expect(heading).toHaveAttribute('aria-label', 'Chats from Yesterday');+ });++ it('uses raw groupName for unrecognized translation keys', () => {+ render(<DateLabel groupName="Unknown Group" />);+ expect(+ screen.getByRole('heading', { level: 2, name: 'Chats from Unknown Group' }),+ ).toBeInTheDocument();+ });++ it('applies mt-0 for the first date header', () => {+ const { container } = render(<DateLabel groupName="com_ui_date_today" isFirst={true} />);+ const heading = container.querySelector('h2');+ expect(heading).toHaveClass('mt-0');+ expect(heading).not.toHaveClass('mt-2');+ });++ it('applies mt-2 for non-first date headers', () => {+ const { container } = render(<DateLabel groupName="com_ui_date_today" isFirst={false} />);+ const heading = container.querySelector('h2');+ expect(heading).toHaveClass('mt-2');+ expect(heading).not.toHaveClass('mt-0');+ });+});diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.jsonindex 9f641fdb16..67111586ff 100644--- a/client/src/locales/en/translation.json+++ b/client/src/locales/en/translation.json@@ -2,6 +2,7 @@"chat_direction_left_to_right": "Left to Right","chat_direction_right_to_left": "Right to Left","com_a11y_ai_composing": "The AI is still composing.",+ "com_a11y_chats_date_section": "Chats from {{date}}","com_a11y_end": "The AI has finished their reply.","com_a11y_selected": "selected","com_a11y_start": "The AI has started their reply.",