From af0fdb1667718fe2ee0119eaa260b0b60fa69872 Mon Sep 17 00:00:00 2001 From: Umeokonkwo Samuel Date: Mon, 28 Sep 2026 00:57:28 +0100 Subject: [PATCH] fix: apply theme tokens to page surfaces Closes #962 --- app/(dashboard)/layout.tsx | 2 +- app/globals.css | 5 +++-- app/layout.tsx | 2 +- app/settings/language/page.tsx | 2 +- app/styles/themes/high-contrast.test.tsx | 20 ++++++++++++++++++++ components/navbar/MobileBottomTabs.tsx | 2 +- components/navbar/mobile-drawer.tsx | 2 +- components/patterns/DisputeActionPattern.tsx | 2 +- 8 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/(dashboard)/layout.tsx b/app/(dashboard)/layout.tsx index c665c551..54f37c6f 100644 --- a/app/(dashboard)/layout.tsx +++ b/app/(dashboard)/layout.tsx @@ -43,7 +43,7 @@ export default function DashboardLayout({ }; return ( -
+
- + {/* Skip-to-content: first focusable element in every page — WCAG 2.4.1 */} {children} diff --git a/app/settings/language/page.tsx b/app/settings/language/page.tsx index ca05578f..807caae4 100644 --- a/app/settings/language/page.tsx +++ b/app/settings/language/page.tsx @@ -23,7 +23,7 @@ export default function LanguageSettingsPage() { const { t } = useTranslation(); return ( -
+
{/* Page heading */}

diff --git a/app/styles/themes/high-contrast.test.tsx b/app/styles/themes/high-contrast.test.tsx index 4cb6d8db..089447b0 100644 --- a/app/styles/themes/high-contrast.test.tsx +++ b/app/styles/themes/high-contrast.test.tsx @@ -1,6 +1,8 @@ import React from "react" import { render, screen } from "@testing-library/react" import { ThemeProvider } from "@/components/theme-provider" +import { readFileSync } from "node:fs" +import { join } from "node:path" // --------------------------------------------------------------------------- // Helpers @@ -31,6 +33,24 @@ describe("High-Contrast Theme", () => { document.documentElement.className = "" }) + it.each([ + ["light", "0 0% 100%", "0 0% 3.9%"], + ["dark", "222 68% 7.45%", "227 100% 93.53%"], + ["high-contrast", "0 0% 0%", "0 0% 100%"], + ])("body uses theme background and foreground tokens in %s mode", (theme, background, foreground) => { + renderWithTheme(theme,
) + + const body = screen.getByTestId("themed-body") + expect(body).toHaveClass("bg-background", "text-foreground") + expect(document.documentElement).toHaveClass(theme) + + const globals = readFileSync(join(process.cwd(), "app/globals.css"), "utf8") + const highContrast = readFileSync(join(process.cwd(), "app/styles/themes/high-contrast.css"), "utf8") + const palette = theme === "high-contrast" ? highContrast : globals + expect(palette).toContain(`--background: ${background}`) + expect(palette).toContain(`--foreground: ${foreground}`) + }) + // ---- Provider support -------------------------------------------------- it("ThemeProvider accepts 'high-contrast' as a forced theme", () => { diff --git a/components/navbar/MobileBottomTabs.tsx b/components/navbar/MobileBottomTabs.tsx index 3a653672..ec800412 100644 --- a/components/navbar/MobileBottomTabs.tsx +++ b/components/navbar/MobileBottomTabs.tsx @@ -63,7 +63,7 @@ export const MobileBottomTabs: React.FC = () => { return (