Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save Theme Preference Using LocalStorage Instead of SessionStorage #92

Open
martyanovandrey opened this issue Dec 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@martyanovandrey
Copy link
Contributor

Currently, the theme preference (light/dark mode) for static documentation is being saved in sessionStorage, causing the user-selected theme to reset when the browser/tab is closed. Instead, we should use localStorage to persist the theme preference across sessions, ensuring a consistent user experience.

Steps to Reproduce:

  1. Change the website theme from the default to another (e.g., from light to dark).
  2. Close the browser or tab.
  3. Reopen the browser or tab and revisit the website.

Expected Behavior:
The website should retain the user's theme preference (light or dark mode) upon reopening the browser.

Actual Behavior:
The theme resets to the default as the preference is stored in sessionStorage.

Proposed Solution:

  • Update the code to store the theme preference in localStorage instead of sessionStorage.
  • Ensure that the theme preference is retrieved from localStorage on page load.

Code Context:

return (sessionStorage.getItem(name) as Settings[T]) || DEFAULT_USER_SETTINGS[name];

@martyanovandrey martyanovandrey added the bug Something isn't working label Dec 13, 2024
@martyanovandrey martyanovandrey moved this to Todo in Help wanted Dec 13, 2024
@martyanovandrey martyanovandrey changed the title Bug: Save Theme Preference Using LocalStorage Instead of SessionStorage Save Theme Preference Using LocalStorage Instead of SessionStorage Dec 13, 2024
@martyanovandrey martyanovandrey moved this from Todo to In progress in Help wanted Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In progress
Development

No branches or pull requests

1 participant