Hernando Abella

Personal Portfolio Website · Step 5 of 7

Add one accessible interaction

Add a light/dark theme button. Keep the initial page usable before JavaScript runs, label the button clearly, and make its state visible rather than relying on an icon alone.

Understand

A control should communicate its purpose and state, and should work for keyboard and pointer users.

Build

Listen for the button click, toggle a class on the document root, and store the selected theme in localStorage. On first visit, respect the system color preference.

Check

The control works by keyboard, its label or pressed state makes sense, and the choice remains after refresh.

Try it

If storage is unavailable, make sure the theme control still works for the current page.