1.2 KiB
1.2 KiB
ADDED Requirements
Requirement: Theme persistence works across visits with fallback
The site MUST persist the user's theme selection across visits so returning users see the last-selected theme.
The site MUST use client-side persistence and MUST support a fallback mechanism:
- Primary:
localStorage - Fallback: a client-side cookie
The effective theme selection order MUST be:
- Stored theme in
localStorage(if available) - Stored theme in a cookie (if localStorage is unavailable)
- Default selection using environment signals
Scenario: LocalStorage persists across a later visit
- WHEN a user selects
lighttheme and later returns to the site in the same browser - THEN the site initializes in
lighttheme before first paint
Scenario: Cookie fallback is used when localStorage is unavailable
- WHEN the browser environment blocks
localStorageaccess and the user selectsdarktheme - THEN the theme is persisted using a client-side cookie and is restored on the next visit
Scenario: No persistence available falls back to defaults
- WHEN both
localStorageand cookie persistence are unavailable - THEN the site falls back to default theme selection using environment signals