3.6 KiB
Mobile Menu Active Contrast Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Make the active mobile portal navigation item readable in both light and dark themes.
Architecture: Keep the existing theme tokens and navigation logic. Add one unlayered semantic CSS class whose var(--ink) background and var(--paper) foreground outrank the global inherited anchor color, and apply it only to the active mobile link.
Tech Stack: Next.js 16, React 19, Tailwind CSS 4, Vitest, Testing Library
Global Constraints
- Light mode must render the active item with white text on a dark surface.
- Dark mode must render the active item with black text on a light surface.
- Inactive links, desktop navigation, theme tokens, spacing, motion, and routing must remain unchanged.
- Production code must follow a witnessed RED/GREEN TDD cycle.
Task 1: Active Mobile Navigation Contrast
Files:
- Modify:
src/components/layout/mobile-portal-menu.test.tsx - Modify:
src/components/layout/mobile-portal-menu.tsx - Modify:
src/app/globals.css
Interfaces:
-
Consumes: existing
MobilePortalMenuprops and the--ink/--papertheme tokens -
Produces: the CSS class
mobile-portal-menu-activeon the single active navigation link -
Step 1: Write the failing regression test
Extend the first component test after opening the menu:
const activeLink = screen.getByRole("link", { name: "Redaktionen" });
const inactiveLink = screen.getByRole("link", { name: "Dashboard" });
expect(activeLink.getAttribute("class")).toContain("mobile-portal-menu-active");
expect(inactiveLink.getAttribute("class")).not.toContain("mobile-portal-menu-active");
This test catches removal or accidental application of the semantic inverse-color class.
- Step 2: Run the focused test and verify RED
Run:
./node_modules/.bin/vitest run src/components/layout/mobile-portal-menu.test.tsx
Expected: the active-link assertion fails because the class is not yet present; the test must not fail from a render or selector error.
- Step 3: Implement the minimal component and CSS change
In the active branch of mobile-portal-menu.tsx, replace the inverse Tailwind color utilities with the semantic class while preserving layout classes:
"mobile-portal-menu-active flex min-h-11 items-center rounded-lg px-3 font-semibold"
In globals.css, directly after the existing mobile menu panel rule, add:
.mobile-portal-menu-active {
background: var(--ink);
color: var(--paper);
}
- Step 4: Run the focused test and verify GREEN
Run:
./node_modules/.bin/vitest run src/components/layout/mobile-portal-menu.test.tsx
Expected: all mobile-menu tests pass with no warnings.
- Step 5: Run full deterministic verification
Run:
./node_modules/.bin/vitest run src
./node_modules/.bin/tsc --noEmit
./node_modules/.bin/eslint .
./node_modules/.bin/drizzle-kit check
git diff --check
Expected: every command exits with status 0.
- Step 6: Run the production build
Run ./node_modules/.bin/next build --webpack with the documented non-secret build-time environment values.
Expected: the optimized production build completes with exit status 0.
- Step 7: Commit the implementation
git add src/components/layout/mobile-portal-menu.test.tsx src/components/layout/mobile-portal-menu.tsx src/app/globals.css
git commit -m "fix: restore mobile menu active contrast"