Skip to content

Fix/dark mode persistence#772

Open
Ayush-kathil wants to merge 3 commits into
komalharshita:mainfrom
Ayush-kathil:fix/dark-mode-persistence
Open

Fix/dark mode persistence#772
Ayush-kathil wants to merge 3 commits into
komalharshita:mainfrom
Ayush-kathil:fix/dark-mode-persistence

Conversation

@Ayush-kathil
Copy link
Copy Markdown

Resolves #746

Description

This pull request fixes a bug where the user's dark mode preference would reset to light mode on every page reload.

Changes Made

  • Updated initTheme() in static/script.js to retrieve the saved theme from localStorage if it exists.
  • Added a try/catch block around the localStorage call to prevent JavaScript execution errors for users with strict privacy settings that block local storage access.
  • If localStorage is empty or unavailable, it safely falls back to the data-theme attribute or defaults to "light".

Testing

  • Toggled dark mode on the homepage and refreshed the page; the dark theme persisted correctly.
  • Ensured the python tests/test_basic.py test suite passes successfully.

- Initialize global cache variables in data_loader.py
- Fix duplicate project IDs in projects.json
- Replace Django escapejs with Jinja tojson filter in project.html
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

@Ayush-kathil is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc-2026 type:bug Something isn't working data type:accessibility ui and removed type:bug Something isn't working gssoc-2026 labels Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Dark mode toggle resets to light mode on every page reload

1 participant