Skip to content

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

🔗 feat: Open Footer Site Links in a New Tab (#15019)

Marco Berettaf1fbaeb6d8a4
diff --git a/client/src/components/Chat/Footer.tsx b/client/src/components/Chat/Footer.tsx
index 90d78737b9..79413c7f68 100644
--- a/client/src/components/Chat/Footer.tsx
+++ b/client/src/components/Chat/Footer.tsx
@@ -63,7 +63,8 @@ function Footer({ className, startupConfig }: FooterProps) {
<a
className="text-text-secondary underline"
href={href}
- rel="noreferrer"
+ target="_blank"
+ rel="noopener noreferrer"
{...otherProps}
>
{children}
diff --git a/client/src/components/Chat/__tests__/Footer.spec.tsx b/client/src/components/Chat/__tests__/Footer.spec.tsx
new file mode 100644
index 0000000000..c855b746f0
--- /dev/null
+++ b/client/src/components/Chat/__tests__/Footer.spec.tsx
@@ -0,0 +1,56 @@
+import React from 'react';
+import { render, screen } from '@testing-library/react';
+import '@testing-library/jest-dom/extend-expect';
+import Footer from '../Footer';
+
+jest.mock('react-gtm-module', () => ({
+ __esModule: true,
+ default: { initialize: jest.fn() },
+}));
+
+jest.mock('~/data-provider', () => ({
+ useGetStartupConfig: jest.fn(() => ({ data: undefined, isFetching: false, error: null })),
+}));
+
+const mockTranslations: Record<string, string> = {
+ com_ui_latest_footer: 'Every AI for Everyone.',
+ com_ui_privacy_policy: 'Privacy policy',
+ com_ui_terms_of_service: 'Terms of service',
+};
+
+jest.mock('~/hooks', () => ({
+ useLocalize: () => (key: string) => mockTranslations[key] ?? key,
+}));
+
+describe('Footer', () => {
+ test('opens the default LibreChat site link in a new tab', () => {
+ render(<Footer startupConfig={null} />);
+ const link = screen.getByRole('link', { name: /LibreChat/ });
+ expect(link).toHaveAttribute('href', 'https://librechat.ai');
+ expect(link).toHaveAttribute('target', '_blank');
+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');
+ });
+
+ test('opens custom footer markdown links in a new tab', () => {
+ render(<Footer startupConfig={{ customFooter: '[Docs](https://example.com/docs)' }} />);
+ const link = screen.getByRole('link', { name: 'Docs' });
+ expect(link).toHaveAttribute('href', 'https://example.com/docs');
+ expect(link).toHaveAttribute('target', '_blank');
+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');
+ });
+
+ test('keeps privacy policy and terms of service links in the same tab', () => {
+ render(
+ <Footer
+ startupConfig={{
+ interface: {
+ privacyPolicy: { externalUrl: 'https://example.com/privacy' },
+ termsOfService: { externalUrl: 'https://example.com/terms' },
+ },
+ }}
+ />,
+ );
+ expect(screen.getByRole('link', { name: 'Privacy policy' })).not.toHaveAttribute('target');
+ expect(screen.getByRole('link', { name: 'Terms of service' })).not.toHaveAttribute('target');
+ });
+});