Skip to content

feat(menu): add an appearance choice that follows the system by default - #217

Merged
brandyscarney merged 1 commit into
mainfrom
feat/dark-mode-preference
Dec 4, 2026
Merged

brandyscarney merged 1 commit into
mainfrom
feat/dark-mode-preference

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

The menu's Dark Mode toggle only switched the palette for the current visit: the app started in light mode on every load and ignored the system dark mode setting. The toggle is replaced with an Appearance section in the menu:

  • System is the default and follows the system dark mode setting (prefers-color-scheme: dark), including changes while the app is open.
  • Light and Dark override the system setting.
  • The choice is saved in Preferences under appearance and used on the next load.

The choices are radios with an icon each, like the other menu items. They use the iOS radio on both platforms, so the picked choice is marked with a checkmark instead of a radio circle. The rows are slightly shorter than the other menu items to keep the section compact.

The user state holds only the saved appearance. A new useSystemDarkMode hook reads the system setting with useSyncExternalStore, and App applies the dark palette to <html> in a layout effect. The palette is set before the schedule data loads, so a dark system no longer shows a light screen first. setAppearance saves before returning its action, like setHasSeenTutorial.

Unit tests cover loading the saved choice, a saved value that is not a choice falling back to System, saving the choice, and the hook following system changes and removing its listener. The unit test for the old toggle is removed. e2e tests check that the choices switch the palette, that System follows the system setting, that the choice is kept after a reload, and that the app is dark before the schedule loads when the system prefers dark mode.

Same change in the other conference apps: ionic-team/ionic-conference-app#1932, ionic-team/ionic-vue-conference-app#128

Based on #77 by @brucelane, who is credited as co-author.

@brandyscarney
brandyscarney requested a review from a team as a code owner December 3, 2026 18:43
@brandyscarney
brandyscarney requested review from thetaPC and removed request for a team December 3, 2026 18:43
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-react-conference-app Ready Ready Preview Dec 3, 2026 10:45pm UTC

Request Review

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES! Thank you!

@brandyscarney brandyscarney changed the title feat(menu): start in the system dark mode and remember the toggle feat(menu): add an appearance choice that follows the system by default Dec 3, 2026
@brandyscarney
brandyscarney force-pushed the feat/dark-mode-preference branch from 828c649 to d875474 Compare December 3, 2026 22:13
The menu's Dark Mode toggle is replaced with an Appearance section with
System, Light and Dark choices. System is the default and follows the
system dark mode setting, including changes while the app is open. The
choice is saved in Preferences and used on the next load.

Co-authored-by: Bruce LANE <138158+brucelane@users.noreply.github.com>
@brandyscarney

Copy link
Copy Markdown
Member Author

@thetaPC I made some changes to this if you want to take another look. This does remove our only toggle example in this app but I have added a follow-up to create a Settings page which will hold this appearance setting as well as a toggle for something like timezone. The other conference app PRs are also needing review.

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@brandyscarney
brandyscarney merged commit b27fa18 into main Dec 4, 2026
6 checks passed
@brandyscarney
brandyscarney deleted the feat/dark-mode-preference branch December 4, 2026 18:38

This branch was successfully deployed

1 active deployment
Preview — 1ca98053 Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants