feat: add dark_mode_switcher component with RTL unit tests (Closes #319) - #347
Merged
godamongstmen897 merged 2 commits intoAug 31, 2026
Merged
Conversation
Implements the app dark/light theme toggle as a keyboard-operable, ARIA-compliant switch (role=switch, aria-checked, aria-label) that persists the chosen theme to localStorage and applies it to the document root. Adds React Testing Library tests verifying node rendering, accessible state, theme application, keyboard operation and persistence. Closes Goldii-locks#319
|
@Max-Owolabi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the app dark/light theme toggle (
dark_mode_switcher) as a keyboard-operable, ARIA-compliant native switch, plus the requested React Testing Library unit tests.Resolves #319
Changes
app/components/dark_mode_switcher.tsx— new theme toggle:role="switch"on a native<button>(Tab to focus, Enter/Space to toggle).aria-checkedand an accessible name (aria-label) that announces the next mode.localStorage.focus-visiblerings and design-token colors.__tests__/dark_mode_switcher.test.tsx— 13 RTL tests covering node rendering,aria-checkedstate, theme application, keyboard operation (Enter/Space), and persistence/restore.Verification
tsc --noEmitpasses.main(the only failing tests are pre-existing and unrelated to this change).