- Issue created by @pdureau
- Issue was unassigned.
- Status changed to Fixed
over 1 year ago 9:59am 22 July 2023 - 🇫🇷France pdureau Paris
Fixed. This fix is as hacky as the upstream issue:
if (document.documentElement.hasAttribute("data-fr-scheme")) { localStorage.setItem("scheme", null); }
Tests
My system: Light
Drupal: Light
Result: Light ✅My system: Light
Drupal: Dark
Result: Dark ✅My system: Light
Drupal: System
Result: Light ✅My system: Dark
Drupal: Light
Result: Light ✅My system: Dark
Drupal: Dark
Result: Dark ✅My system: Dark
Drupal: System
Result: Dark ✅ Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
7 months ago 2:36pm 18 April 2024 - 🇫🇷France NicociN
I have to re-open the issue, because it seems that this update leads to another (new ?) issue on all our projects : the theme switch is not taken into account.
The use case : when I switch, the current page displays properly (according to selected theme), and local storage is also updated with selected theme. But on page reload (sometime we need to reload 2 or 3 times to trigger the issue), the local storage 'scheme' value is set to 'null', leading to a reset of theme (data-fr-scheme : system & data-fr-theme : [your-system-theme]).
Solution : if I comment the added JS (
localStorage.setItem("scheme", null);
in `ui_suite_dsfr/js/theme_switcher.js`) everything works as expected.drupal/ui_suite_dsfr : 1.0.x-dev@dev
Browser : FF / Chrome - 🇫🇷France NicociN
Issue created here 🐛 Theme switches back to default after a few clicks Active .
- 🇫🇷France just_like_good_vibes PARIS
Hello,
we are challenging also this fix, because of the same reason :
With a theme switcher which saves data to localStorage, the desired theme is not kept.