Dashboard with automatic day/night color scheme switching

Solution retrospective
For this challenge I tried to make my javascript more reusable and spent time covering all the edge cases. I've used the @media prefers-color-scheme queries along with CSS so that I have three theme classes, theme--light, theme--dark, and theme--default. theme--default uses the @media queries to automatically follow the system preferred scheme, while light/dark themes are used to pin user preference via javascript when needed.
I've tried to make this one accessible, but it was awkward. One problem I had was attaching the arrow svg's via ::before pseudo classes. The screen reader insists on announcing the image, no matter what. In the end I used a .visually-hidden span and aria-none in a couple of places to clean up the screen reader experience.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on J Cooper's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord