? NPM Resource Changed PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
12 Dec 2022

Pull Request for Issue # .

This is nowhere near production ready!!!

Summary of Changes

  • Upgrade to BS 5.3
  • Import my own theme switcher (just for the demo)
  • Patch tinyMCE to support switching themes (this needs some PHP code on picking up the override themes and a decision on the convention, I just went with the -dark but maybe it's not ideal)
  • Patched com_users to add a new a11y field prefers_color_scheme with possible values: null, dark, light and also created a JSON endpoint so that the toggler could sync the actual user state with the DB value.
  • Patched the Atum template to respect the user setting above (or fallback to light, this probably needs an option on the template level)
  • At the moment there is no way to listen for OS changes and adapt but it's an easy addition

And here's a little demo:

demo.mp4

Testing Instructions

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

e853c0d 11 Dec 2022 avatar dgrammatiko cs
avatar dgrammatiko dgrammatiko - open - 12 Dec 2022
avatar dgrammatiko dgrammatiko - change - 12 Dec 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Dec 2022
Category Administration Templates (admin) JavaScript Repository NPM Change Installation Front End Plugins
avatar dgrammatiko dgrammatiko - change - 12 Dec 2022
Labels Added: NPM Resource Changed PR-5.0-dev
avatar joomla-cms-bot joomla-cms-bot - change - 14 Dec 2022
Category Administration Templates (admin) JavaScript Repository NPM Change Installation Front End Plugins Administration com_users Templates (admin) JavaScript Repository NPM Change Front End
avatar dgrammatiko dgrammatiko - change - 14 Dec 2022
The description was changed
avatar dgrammatiko dgrammatiko - edited - 14 Dec 2022
avatar joomla-cms-bot joomla-cms-bot - change - 14 Dec 2022
Category Administration Templates (admin) JavaScript Repository NPM Change Front End com_users Administration com_users Templates (admin) JavaScript Repository NPM Change
d37060c 14 Dec 2022 avatar dgrammatiko input
5fff818 14 Dec 2022 avatar dgrammatiko cs
avatar dgrammatiko
dgrammatiko - comment - 15 Dec 2022

@HLeithner could you sync the v5.0 branch so there would be an installable package? I would like to have some feedback from people here and having an installable zip would help. Thanks

avatar dgrammatiko dgrammatiko - change - 15 Dec 2022
Title
[5.0][wip] Upgrade to bs53 (nightly), dark/light themes
[5.0][RFC] Upgrade to bs53 (nightly), dark/light themes
avatar dgrammatiko dgrammatiko - edited - 15 Dec 2022
avatar dgrammatiko dgrammatiko - change - 15 Dec 2022
The description was changed
avatar dgrammatiko dgrammatiko - edited - 15 Dec 2022
avatar dgrammatiko dgrammatiko - change - 15 Dec 2022
The description was changed
avatar dgrammatiko dgrammatiko - edited - 15 Dec 2022
avatar dgrammatiko dgrammatiko - change - 15 Dec 2022
The description was changed
avatar dgrammatiko dgrammatiko - edited - 15 Dec 2022
avatar HLeithner
HLeithner - comment - 15 Dec 2022

@HLeithner could you sync the v5.0 branch so there would be an installable package? I would like to have some feedback from people here and having an installable zip would help. Thanks

done

avatar HLeithner HLeithner - change - 15 Dec 2022
Labels Added: ?
avatar dgrammatiko dgrammatiko - change - 15 Dec 2022
The description was changed
avatar dgrammatiko dgrammatiko - edited - 15 Dec 2022
avatar dgrammatiko dgrammatiko - change - 15 Dec 2022
Title
[5.0][RFC] Upgrade to bs53 (nightly), dark/light themes
[5.0][RFC] Upgrade to bs53 (nightly) + new feature `prefers_color_scheme`
avatar dgrammatiko dgrammatiko - edited - 15 Dec 2022
avatar Bond97
Bond97 - comment - 16 Dec 2022

Prebuilt zip package is unable to download.
изображение
изображение

avatar HLeithner
HLeithner - comment - 16 Dec 2022

I will have a look what's wrong with the build script.

avatar dgrammatiko dgrammatiko - change - 16 Dec 2022
Title
[5.0][RFC] Upgrade to bs53 (nightly) + new feature `prefers_color_scheme`
[5.0][RFC][NO CACHE] Upgrade to bs53 (nightly) + new feature `prefers_color_scheme`
avatar dgrammatiko dgrammatiko - edited - 16 Dec 2022
083b4e3 17 Dec 2022 avatar dgrammatiko icons
7ffb415 22 Dec 2022 avatar dgrammatiko CS
avatar dgrammatiko dgrammatiko - change - 22 Dec 2022
Title
[5.0][RFC][NO CACHE] Upgrade to bs53 (nightly) + new feature `prefers_color_scheme`
[5.0][RFC] Upgrade to bs53 (nightly) + new feature `prefers_color_scheme`
avatar dgrammatiko dgrammatiko - edited - 22 Dec 2022
avatar nikosdion
nikosdion - comment - 9 Jan 2023

Dark Mode is not an accessibility setting. Its setting has no place in the a11y options. Its place is in the user preferences, along with the language and the editor. That's why I had put it as a basic option in my PR.

The browser's colour scheme should be followed by default. The same user can and will have different colour scheme preferences based on the ambient light. The expectation is to toggle the system's colour scheme and have all applications and sites follow it. This is a native feature, there is no need for JavaScript, especially in the frontend. I had already demonstrated that in my PR.

You can totally force light or dark colour scheme for users who want it by using a simple option and CSS classes, as I had demonstrated in my PR.

You do not need to change TinyMCE's JavaScript to change themes. You had to do that because you are not using the native browser way of switching colours. You can simply use TinyMCE's default options —as set in the plugin— to load a custom theme which uses media queries and CSS classes to switch colour schemes, as I had demonstrated in my PR.

You have not attempted to apply dark mode to CodeMirror, which is something I had already demonstrated as being perfectly possible (and dead easy) in my PR.

You do not have a way for the user to set and use custom colours in dark mode, unlike my PR.

Okay, here's what. You came to my PR and told me that I basically don't understand how to do anything in the frontend and that everything I did was wrong. Now you come here with your own PR and it lacks even the most basic features, does not attempt to cover any use case besides the one you decided makes sense to you, is laden with technical debt (JavaScript everywhere, JavaScript nobody can maintain as it's been proven time and again), has zero foresight for third party developers (especially editor plugin makers!), and I could go on — but I won't.

This PR is a farce. If that's the subpar code y'all want to see in Joomla I am pretty sure my decision not to contribute code to the core in 2023 was the right one.

avatar dgrammatiko
dgrammatiko - comment - 9 Jan 2023

@nikosdion did you just reviewed the code without actually testing it?

So couple of quick answers here:

  • prefers-colour-scheme by definition is an accessibility option: https://www.w3.org/TR/css-color-adjust-1/
  • The solution for the prefers-colour-scheme DERIVES from the work the Bootstrap people did, I'm not implementing something my way as you keep repeating and contrary to what you have done in your PR...
  • So much JS: actually for tinyMCE, which IS a Client Side Render App, we already use JS to render the app, what I did was wrap the render parts to a function that can be called whenever the MeqiaQuery event is fired (can listen to the actual event or a propagated one). Same goes for Codemirror, the reason I didn't touched it is plain simple: the code needs to be updated to the latest major version so, the changes would have to be redone for that version (so I left it for the own Codemirror major update PR)
  • There is no need for JS: that's IF you can assure that none of the pages have any CSR apps (tinyMCE, CM, etc) but since the implementation affects the backend which is requiring JS by default, listening for the event in JS sounds the best option. The other is to refresh the page, which is not what users expect in 2023 for some client side functionality (and neither should be an acceptable solution for the project)...
avatar dgrammatiko
dgrammatiko - comment - 17 Feb 2023

FWIW @wilsonge already created the joomla.org template that is using the same approach as I did here (with the only exception that this PR due to the early alpha version of Bootstrap is not supporting the CSS media query for automatically switching the themes but that was fixed upstream already) and could be viewed here

This PR still contains a lot of the required changes, although the Muta template (once updated to the latest Bootstrap) would be an easier path to upgrade the Atum template. The only part that might be worth keeping from this PR is the way the switcher directly saves the state of the user to the DB (maybe creating a theme switcher module is a better fit)

avatar dgrammatiko dgrammatiko - close - 17 Feb 2023
avatar dgrammatiko dgrammatiko - change - 17 Feb 2023
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2023-02-17 14:33:22
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - change - 29 May 2023
Status Closed New
Closed_Date 2023-02-17 14:33:22
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - change - 29 May 2023
Status New Pending
avatar dgrammatiko dgrammatiko - reopen - 29 May 2023
avatar dgrammatiko dgrammatiko - change - 29 May 2023
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2023-05-29 10:29:07
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - close - 29 May 2023

Add a Comment

Login with GitHub to post a comment