Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: improve UI readability in light mode and toast accessibility (#2410)

VisveshJ9708a395d076
diff --git a/frontend/app/globals.css b/frontend/app/globals.css
index c353595c4..2e82a67d8 100644
--- a/frontend/app/globals.css
+++ b/frontend/app/globals.css
@@ -1153,3 +1153,28 @@
scroll-behavior: auto !important;
}
}
+
+/* Sonner toast left-border overrides — outside all @layer blocks so these
+ unlayered rules beat Sonner's own injected unlayered border shorthand.
+ Uses the same hex values as the SVG icons for exact colour match. */
+
+/* OSS brand: all themes */
+[data-sonner-toast][data-type="success"] {
+ border-left-color: #24a148 !important;
+ border-left-width: 3px !important;
+}
+
+[data-sonner-toast][data-type="warning"] {
+ border-left-color: #f1c21b !important;
+ border-left-width: 3px !important;
+}
+
+[data-sonner-toast][data-type="error"] {
+ border-left-color: #da1e28 !important;
+ border-left-width: 3px !important;
+}
+
+/* IBM/SaaS brand: square corners in addition */
+[data-theme="ibm"] [data-sonner-toast] {
+ border-radius: 0 !important;
+}
diff --git a/frontend/app/settings/_components/model-provider-dialog-footer.tsx b/frontend/app/settings/_components/model-provider-dialog-footer.tsx
index c5e4ce82c..94d10abef 100644
--- a/frontend/app/settings/_components/model-provider-dialog-footer.tsx
+++ b/frontend/app/settings/_components/model-provider-dialog-footer.tsx
@@ -50,14 +50,14 @@ const ModelProviderDialogFooter = ({
if (showRemoveConfirm) {
const hasAffected = !!affectedModels && affectedModels.length > 0;
return (
- <DialogFooter className="mt-4 flex flex-col items-stretch gap-3 rounded-lg border border-red-500/10 bg-red-500/5 px-4 py-3 animate-in fade-in-0 slide-in-from-bottom-2 duration-150 sm:flex-row sm:items-center">
- <div className="min-w-0 flex-1 border-l-2 border-destructive pl-3 text-sm text-red-100">
+ <DialogFooter className="mt-4 flex flex-col items-stretch gap-3 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 animate-in fade-in-0 slide-in-from-bottom-2 duration-150 sm:flex-row sm:items-center">
+ <div className="min-w-0 flex-1 border-l-2 border-destructive pl-3 text-sm text-foreground">
{hasAffected ? (
<div className="flex flex-col gap-1">
<span>
Semantic search will break for documents embedded with:
</span>
- <ul className="list-disc pl-5 text-xs text-red-200/80">
+ <ul className="list-disc pl-5 text-xs text-muted-foreground">
{affectedModels!.map((m) => (
<li key={m.model}>
<span className="font-mono">{m.model}</span>{" "}
diff --git a/frontend/components/task-error-content.test.tsx b/frontend/components/task-error-content.test.tsx
index f02482df5..6e1bcd4d1 100644
--- a/frontend/components/task-error-content.test.tsx
+++ b/frontend/components/task-error-content.test.tsx
@@ -193,15 +193,43 @@ describe("TaskErrorContent — interaction handlers", () => {
const user = userEvent.setup();
mockOpenTaskDialog.mockReset();
- renderWithProviders(
- <TaskErrorContent task={makeFailedTask()} defaultExpanded />,
- );
+ renderWithProviders(<TaskErrorContent task={makeFailedTask()} />);
await user.click(screen.getByRole("button", { name: "Open task details" }));
expect(mockOpenTaskDialog).toHaveBeenCalledWith("task-interaction-1");
});
+ it("keyboard activation of task-details button calls openTaskDialog without toggling the accordion", async () => {
+ const user = userEvent.setup();
+ mockOpenTaskDialog.mockReset();
+
+ renderWithProviders(<TaskErrorContent task={makeFailedTask()} />);
+
+ const expandableRow = document.querySelector(
+ "[aria-expanded]",
+ ) as HTMLElement;
+ expect(expandableRow.getAttribute("aria-expanded")).toBe("false");
+
+ const detailsButton = screen.getByRole("button", {
+ name: "Open task details",
+ });
+ detailsButton.focus();
+
+ // Enter fires the button's click handler but must not bubble up to the
+ // outer onKeyDown toggle.
+ await user.keyboard("{Enter}");
+ expect(mockOpenTaskDialog).toHaveBeenCalledWith("task-interaction-1");
+ expect(expandableRow.getAttribute("aria-expanded")).toBe("false");
+
+ mockOpenTaskDialog.mockReset();
+
+ // Space likewise.
+ await user.keyboard(" ");
+ expect(mockOpenTaskDialog).toHaveBeenCalledWith("task-interaction-1");
+ expect(expandableRow.getAttribute("aria-expanded")).toBe("false");
+ });
+
it("headerEnd click does not toggle the accordion (stopPropagation)", async () => {
const user = userEvent.setup();
const headerEndClick = vi.fn();
diff --git a/frontend/components/task-error-content.tsx b/frontend/components/task-error-content.tsx
index e4b7f1e33..117e467e3 100644
--- a/frontend/components/task-error-content.tsx
+++ b/frontend/components/task-error-content.tsx
@@ -29,6 +29,9 @@ import {
import { formatTaskTimestamp, parseTimestamp } from "@/lib/time-utils";
import { cn } from "@/lib/utils";
+/** Stops both click and keyboard events from bubbling to parent handlers. */
+const stopEvent = (e: React.SyntheticEvent) => e.stopPropagation();
+
interface TaskErrorContentProps {
task: Task;
mode?: "recent" | "past";
@@ -200,6 +203,15 @@ export function TaskErrorContent({
{!isExpanded && (
<p className={statusPillClassName}>{statusLabel}</p>
)}
+ {/* biome-ignore lint/a11y/noStaticElementInteractions: presentation wrapper; stopPropagation only, no interactive semantics */}
+ <div
+ role="presentation"
+ onClick={stopEvent}
+ onKeyDown={stopEvent}
+ >
+ {openTaskDialogButton}
+ </div>
+ {/* biome-ignore lint/a11y/noStaticElementInteractions: stop-propagation wrapper */}
<span onClick={(event) => event.stopPropagation()}>
{headerEnd}
</span>
@@ -231,7 +243,6 @@ export function TaskErrorContent({
const componentCause = formatApiComponent(fileInfo.component);
const isWarning = isTaskFileWarning(fileInfo);
const isCancelled = isFileCancelled(fileInfo);
- const isFirst = index === 0;
return (
<div
@@ -270,7 +281,6 @@ export function TaskErrorContent({
>
{fileName}
</p>
- {isFirst && openTaskDialogButton}
</div>
<p
className={cn(
diff --git a/frontend/components/ui/sonner.test.tsx b/frontend/components/ui/sonner.test.tsx
new file mode 100644
index 000000000..3a6f14881
--- /dev/null
+++ b/frontend/components/ui/sonner.test.tsx
@@ -0,0 +1,31 @@
+import { render } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import { ErrorIcon, SuccessIcon, WarningIcon } from "./sonner";
+
+// Stub next-themes — not available in jsdom.
+vi.mock("next-themes", () => ({ useTheme: () => ({ theme: "light" }) }));
+// Stub sonner's Toaster — it injects a <style> tag using browser APIs not in jsdom.
+vi.mock("sonner", () => ({ Toaster: () => null }));
+
+describe("Sonner toast icon components", () => {
+ it("SuccessIcon renders an svg with the green circle fill", () => {
+ const { container } = render(<SuccessIcon />);
+ const svg = container.querySelector("svg");
+ expect(svg).not.toBeNull();
+ expect(container.innerHTML).toContain("#24a148");
+ });
+
+ it("WarningIcon renders an svg with the amber circle fill", () => {
+ const { container } = render(<WarningIcon />);
+ const svg = container.querySelector("svg");
+ expect(svg).not.toBeNull();
+ expect(container.innerHTML).toContain("#f1c21b");
+ });
+
+ it("ErrorIcon renders an svg with the red circle fill", () => {
+ const { container } = render(<ErrorIcon />);
+ const svg = container.querySelector("svg");
+ expect(svg).not.toBeNull();
+ expect(container.innerHTML).toContain("#da1e28");
+ });
+});
diff --git a/frontend/components/ui/sonner.tsx b/frontend/components/ui/sonner.tsx
index fc324aa23..d55219347 100644
--- a/frontend/components/ui/sonner.tsx
+++ b/frontend/components/ui/sonner.tsx
@@ -5,6 +5,43 @@ import { Toaster as Sonner } from "sonner";
type ToasterProps = React.ComponentProps<typeof Sonner>;
+// Toast icons matching Carbon's inline-notification icon style.
+// Paths derived from Carbon's filled icon set (MIT licence), scaled to 16×16 viewBox.
+// Exported for unit testing only.
+
+// checkmark--filled: green circle + white checkmark
+export const SuccessIcon = () => (
+ <svg viewBox="0 0 16 16" className="size-5 shrink-0" aria-hidden>
+ <path
+ fill="#24a148"
+ d="M8 1C4.1 1 1 4.1 1 8s3.1 7 7 7 7-3.1 7-7-3.1-7-7-7z"
+ />
+ <path fill="white" d="M7 11 3.5 7.5l1-1L7 9l5.5-5.5 1 1z" />
+ </svg>
+);
+
+// warning--alt--filled: amber circle + white exclamation
+export const WarningIcon = () => (
+ <svg viewBox="0 0 16 16" className="size-5 shrink-0" aria-hidden>
+ <path
+ fill="#f1c21b"
+ d="M8 1C4.1 1 1 4.1 1 8s3.1 7 7 7 7-3.1 7-7-3.1-7-7-7z"
+ />
+ <path fill="#161616" d="M7.25 4.75h1.5v5h-1.5zM7.25 11.25h1.5v1.5h-1.5z" />
+ </svg>
+);
+
+// error--filled: red circle + white backslash
+export const ErrorIcon = () => (
+ <svg viewBox="0 0 16 16" className="size-5 shrink-0" aria-hidden>
+ <path
+ fill="#da1e28"
+ d="M8 1C4.1 1 1 4.1 1 8s3.1 7 7 7 7-3.1 7-7-3.1-7-7-7z"
+ />
+ <path fill="white" d="m10.7 11.5-6.2-6.2.8-.8 6.2 6.2z" />
+ </svg>
+);
+
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme();
@@ -12,18 +49,30 @@ const Toaster = ({ ...props }: ToasterProps) => {
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group"
+ icons={{
+ success: <SuccessIcon />,
+ warning: <WarningIcon />,
+ error: <ErrorIcon />,
+ }}
toastOptions={{
classNames: {
toast:
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
+ // Mimics Carbon inline-notification (no Carbon package — project tokens only):
+ // light → tinted surface (accent-* bg) + accent-foreground left border
+ // dark → neutral card surface + accent-foreground left border only
success:
- "group-[.toaster]:!bg-green-600 group-[.toaster]:!text-white group-[.toaster]:!border-green-600",
+ "group-[.toaster]:!bg-accent-emerald dark:group-[.toaster]:!bg-card group-[.toaster]:!text-foreground [&_[data-description]]:!text-muted-foreground",
warning:
- "group-[.toaster]:!bg-amber-500 group-[.toaster]:!text-white group-[.toaster]:!border-amber-500",
+ "group-[.toaster]:!bg-accent-amber dark:group-[.toaster]:!bg-card group-[.toaster]:!text-foreground [&_[data-description]]:!text-muted-foreground",
error:
- "group-[.toaster]:!bg-red-600 group-[.toaster]:!text-white group-[.toaster]:!border-red-600",
+ "group-[.toaster]:!bg-accent-red dark:group-[.toaster]:!bg-card group-[.toaster]:!text-foreground [&_[data-description]]:!text-muted-foreground",
+ // Override sonner's fixed 16×16 icon slot so the 20×20 circle renders fully,
+ // and align it to the top of the content block (next to the title).
+ icon: "!size-5 !h-auto self-start mt-0.5",
description: "!text-muted-foreground",
- actionButton: "!bg-primary !text-primary-foreground",
+ actionButton:
+ "!bg-secondary !text-secondary-foreground hover:!bg-secondary-hover",
cancelButton: "!bg-muted !text-muted-foreground",
},
}}