If I enable Dark Mode, I want it to stay this way until it is disabled rather than reset on page load.
Downstream report: https://phabricator.miraheze.org/T5065
Fixing this requires two steps:
- Applying the client-dark-mode class on page load, rather than using JS. This means we need a way to manipulate the <html> element server-side before rendering (done with https://gerrit.wikimedia.org/r/c/mediawiki/core/+/592766)
- About why it needs to be done on <html> and not <body> (which was already mutable in MW): https://stackoverflow.com/q/51589185/604142 and https://stackoverflow.com/a/52937920/604142
- Persist the option to use dark mode across requests. Full-document caching systems such as Varnish may make this difficult for logged out users and/or some read-only wikis. How to solve this is still up for debate (see comments)