diff --git a/webui/src/components/settings/models/ModelsSettings.tsx b/webui/src/components/settings/models/ModelsSettings.tsx
index 1e83f09e7..c6cef2788 100644
--- a/webui/src/components/settings/models/ModelsSettings.tsx
+++ b/webui/src/components/settings/models/ModelsSettings.tsx
@@ -758,7 +758,7 @@ export function ModelsSettings({
{presetConfigured ? (
) : (
-
+
)}
diff --git a/webui/src/components/settings/models/ProviderSettings.tsx b/webui/src/components/settings/models/ProviderSettings.tsx
index 8d56e173e..e252ea85d 100644
--- a/webui/src/components/settings/models/ProviderSettings.tsx
+++ b/webui/src/components/settings/models/ProviderSettings.tsx
@@ -1184,7 +1184,7 @@ export function ProvidersSettings({
className="group settings-list-row flex w-full items-center justify-between gap-4 py-2.5 text-left transition-colors settings-hover"
>
-
+
@@ -1272,41 +1272,45 @@ export function ProviderIcon({
}) {
const brand = providerBrand(provider);
const Icon = PROVIDER_ICONS[provider] ?? Hexagon;
- const { logoUrl, onLogoError, onLogoLoad } = useLogoFallback(brand?.logoUrls);
+ const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(brand?.logoUrls);
+ const showRemoteLogo = showBrandLogos && Boolean(logoUrl);
+ const showLoadedLogo = showRemoteLogo && logoLoaded;
- if (showBrandLogos && logoUrl) {
- return (
+ return (
+
+ {showBrandLogos && brand
+ ? brand.initials
+ : }
+
+ {showRemoteLogo ? (
-
- );
- }
- if (showBrandLogos && brand) {
- return (
-
- {brand.initials}
-
- );
- }
- return (
-
-
+ ) : null}
);
}
diff --git a/webui/src/tests/provider-icon.test.tsx b/webui/src/tests/provider-icon.test.tsx
new file mode 100644
index 000000000..0f417862b
--- /dev/null
+++ b/webui/src/tests/provider-icon.test.tsx
@@ -0,0 +1,95 @@
+import { cleanup, fireEvent, render } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+
+import { ProviderIcon } from "@/components/settings/models/ProviderSettings";
+import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback";
+import { providerBrand } from "@/lib/provider-brand";
+
+describe("settings provider icons", () => {
+ beforeEach(__clearLogoFallbackCacheForTests);
+ afterEach(cleanup);
+
+ function expectFootprint(icon: Element) {
+ expect(icon).toHaveClass("h-9", "w-9", "shrink-0", "overflow-hidden", "rounded-[10px]");
+ expect(icon.className.split(/\s+/).some((value) => value.startsWith("border"))).toBe(false);
+ }
+
+ it.each(["openai_codex", "anthropic", "deepseek", "gemini", "xai_grok"])(
+ "shows %s as a single full-size logo after loading",
+ (provider) => {
+ const { container } = render();
+ const icon = container.firstElementChild!;
+ const image = icon.querySelector("img")!;
+ const fallback = icon.querySelector("span")!;
+
+ expectFootprint(icon);
+ expect(icon).toHaveClass("bg-muted");
+ expect(fallback).toHaveTextContent(providerBrand(provider)!.initials);
+ expect(fallback).toHaveClass("opacity-100");
+ expect(image).toHaveClass("h-full", "w-full", "object-contain", "opacity-0");
+ expect(image).toHaveAttribute("alt", "");
+
+ fireEvent.load(image);
+
+ expectFootprint(icon);
+ expect(icon).toHaveClass("bg-transparent");
+ expect(icon).not.toHaveClass("bg-muted");
+ expect(icon).not.toHaveAttribute("style");
+ expect(fallback).toHaveClass("opacity-0");
+ expect(image).toHaveClass("opacity-100");
+ expect(image).not.toHaveClass("invert", "grayscale");
+ },
+ );
+
+ it("keeps its placeholder through alternate URLs and complete image failure", () => {
+ const { container } = render();
+ const icon = container.firstElementChild!;
+ const fallback = icon.querySelector("span")!;
+
+ for (const url of providerBrand("openai_codex")!.logoUrls) {
+ const image = icon.querySelector("img")!;
+ expect(image).toHaveAttribute("src", url);
+ expect(image).toHaveClass("opacity-0");
+ fireEvent.error(image);
+ expect(container.firstElementChild).toBe(icon);
+ expectFootprint(icon);
+ expect(icon).toHaveClass("bg-muted");
+ expect(fallback).toHaveClass("opacity-100");
+ }
+
+ expect(icon.querySelector("img")).toBeNull();
+ expect(fallback).toHaveTextContent("AI");
+ expect(icon).toHaveAttribute("aria-hidden", "true");
+ });
+
+ it("respects disabled brand logos without changing footprint, including cached logos", () => {
+ const { container, rerender } = render();
+ const icon = container.firstElementChild!;
+ fireEvent.load(icon.querySelector("img")!);
+
+ rerender();
+ expect(container.firstElementChild).toBe(icon);
+ expectFootprint(icon);
+ expect(icon).toHaveClass("bg-muted");
+ expect(icon.querySelector("img")).toBeNull();
+ expect(icon.querySelector("svg")).not.toBeNull();
+ expect(icon).not.toHaveTextContent("AI");
+
+ rerender();
+ expectFootprint(icon);
+ expect(icon).toHaveClass("bg-transparent");
+ expect(icon.querySelector("img")).toHaveClass("opacity-100");
+ });
+
+ it("uses the same footprint for unknown and custom providers", () => {
+ const { container, rerender } = render();
+ expectFootprint(container.firstElementChild!);
+ expect(container.querySelector("img")).toBeNull();
+ expect(container.querySelector("svg")).not.toBeNull();
+
+ rerender();
+ expectFootprint(container.firstElementChild!);
+ expect(container.querySelector("img")).toBeNull();
+ expect(container.querySelector("svg")).not.toBeNull();
+ });
+});
diff --git a/webui/src/tests/settings-providers.test.tsx b/webui/src/tests/settings-providers.test.tsx
index 80556a8ad..24640ad4d 100644
--- a/webui/src/tests/settings-providers.test.tsx
+++ b/webui/src/tests/settings-providers.test.tsx
@@ -1,4 +1,5 @@
import { fireEvent, screen, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { expect, it, vi } from "vitest";
import type { SettingsPayload } from "@/lib/types";
import { requestMutationMock, jsonResponse, settingsPayload, renderSettingsView, installSettingsViewTestHooks } from "@/tests/settings-test-utils";
@@ -14,6 +15,37 @@ async function chooseProviderToConfigure(label: string) {
describe("Settings providers", () => {
installSettingsViewTestHooks();
+ it("keeps provider labels and keyboard configuration accessible with decorative logos", async () => {
+ const user = userEvent.setup();
+ const payload: SettingsPayload = {
+ ...settingsPayload(),
+ providers: [{
+ name: "openai_codex",
+ label: "OpenAI Codex",
+ configured: true,
+ auth_type: "oauth",
+ api_key_required: false,
+ api_key_hint: null,
+ api_base: null,
+ model_catalog: "builtin",
+ oauth_account: "test-account",
+ oauth_login_supported: true,
+ }],
+ };
+ renderSettingsView({ initialSection: "models", initialSettings: payload });
+
+ const provider = await screen.findByRole("button", { name: "OpenAI Codex", exact: true });
+ expect(within(provider).getByText("Configure")).toBeInTheDocument();
+ expect(within(provider).queryByRole("img")).not.toBeInTheDocument();
+ provider.focus();
+ await user.keyboard("{Enter}");
+ expect(await screen.findByRole("dialog", { name: "OpenAI Codex" })).toBeInTheDocument();
+ await user.keyboard("{Escape}");
+ await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
+ expect(provider).toHaveFocus();
+ expect(requestMutationMock).not.toHaveBeenCalled();
+ });
+
it("signs in to the xAI Grok provider", async () => {
const base = settingsPayload();