- Issue created by @pdureau
- Issue was unassigned.
-
pdureau β
committed d5a73158 on 1.0.x
Issue #3340307 by pdureau: Theme scheme setting is overriden by browser...
-
pdureau β
committed d5a73158 on 1.0.x
- Status changed to Fixed
11 months 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
2 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