1.6 KiB
Mobile Menu Active Contrast Design
Context
The active navigation link in the mobile portal menu uses Tailwind's
text-background utility. The project also defines an unlayered global
a { color: inherit; } rule. Unlayered CSS outranks Tailwind utilities in the
cascade, so the link inherits the surrounding text color instead of using the
intended inverse color. This produces dark text on a dark active background in
light mode and the corresponding low-contrast result in dark mode.
Design
Give the active mobile navigation link one semantic class owned by the mobile menu component. Define that class in the existing global stylesheet, outside Tailwind's utility layer, with the portal's established inverse theme tokens:
- background:
var(--ink) - text:
var(--paper)
The existing tokens already reverse with the selected theme. The result is a dark surface with white text in light mode and a light surface with black text in dark mode. Inactive links, menu spacing, motion, routing, and interaction remain unchanged.
Verification
Extend the existing mobile-menu component test to assert that the active link receives the semantic contrast class while an inactive link does not. Observe the new test fail before adding the production class, then pass after the CSS and component changes. Run the focused test, all source tests, TypeScript, ESLint, and the production webpack build.
Scope
This change is limited to:
src/components/layout/mobile-portal-menu.tsxsrc/components/layout/mobile-portal-menu.test.tsxsrc/app/globals.css
No theme tokens, desktop navigation, or other link styles will be changed.