NoroffFEU / yeetsheet

1 stars 4 forks source link

Improve Dark Mode Toggle: Consistent Error Handling and Theme Management #135

Open FredrikMohag opened 6 days ago

FredrikMohag commented 6 days ago

The current dark mode toggle functionality can be improved for better consistency and error handling. Suggested improvements include:

  1. Throw errors if elements (#darkModeToggleBtn, .toggle-text) are missing to aid in debugging.

  2. Consistent use of localStorage by storing both "light" and "dark" themes, instead of removing the key for dark mode.

  3. Add aria-pressed attribute to the toggle button for better accessibility.

  4. Refactor to reduce duplicate DOM manipulations and improve readability.

Implementing these changes will make the toggle more robust and user-friendly.

MandeepKS commented 1 day ago

Task has been completed. Send further to review.

FredrikMohag commented 1 hour ago

@MandeepKS do you have the PR for these improvements?