In T319449 we will create a toggle for switching between max width and non-max-width mode. Initially this will only persist for logged in users. We hit a similar problem with T246427 but decided in that case it was not worthwhile adding code for one preference however as the web interface has evolved, a generalized solution would be very valuable.
We should explore generalizing a way for certain features to be set on the client side using localStorage and a small inline script that reads localStorage prior to rendering. I've sketched out a proof of concept at https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/845667/5/includes/templates/skin.mustache
It's hoped in future this generalized code could be used to support the following future features:
- Dark mode
- Font-size changing
Possibly with some refactoring:
- Table of contents collapse behaviour
- Sidebar state (previously explored in T246427)