Advanced notice of changes to JS Minification affecting supported stables for community developers

Advanced notice of changes to JS Minification affecting supported stables for community developers

by Andrew Lyons -
Number of replies: 6
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi everybody,

If you are a community developer and your plugin includes Javascript, then you will probably want to read all of this post.

Normally we try very hard to not make any changes to generated output (JS, and CSS) from build tools because we know that it can really impact our community developers. In fact, the last time that we made any substantial change to compiled javascript was in MDL-62497 when we introduced support for ES6-style Javascript in Moodle 3.8.

Unfortunately there are times that we must make such changes, and when we do so we do try to consider how this impacts upon you. We know that many of you like to have a single version of your plugin covering a wide range of Moodle versions, and that changes like this may upset your own testing and tooling.

Recently we encountered a bug in the mangle feature of the minification plugin that we use. This plugin is a part of babel/minify, which has unfortunately not seen any updates in the past 18 months and its last release was over two years ago. With countless issues awaiting review or triage there we are not hopeful that it will be resolved soon. Essentially this mangle behaviour is intended rename internal variable and function names to much shorter versions which are consistently used - for example a, b, c, etc. Unfortunately we have found examples in more complex code where this is done incorrectly, and we cannot easily determine when/where this may happen.

Thankfully we can work around this behaviour by disabling the mangle feature of babel-minify, but doing so will lead to changes in our built output.

Given the nature of this bug I am proposing that we backport the change to all supported versions of Moodle (currently 3.9, 3.10, 3.11, 4.0). This is something that we normally do when we update the version of NodeJS that we support, and in other circumstances too. This will mean that there will be a one-off change to your build for stable versions of Moodle. This is an existing part of our processes.

Since we are required to update the built output, I am also proposing that we update to the latest LTS version of NodeJS - LTS Gallium which was released in November. Again, this is a normal part of our release process and we can take the opportunity to update a number of our NodeJS dependencies including babel, and eslint. These changes also generate changes in the output of both AMD and YUI compiled javascript but as we are already making changes to this output, there will be no additional impact.

However I am also proposing that, while we are making such changes, and given Moodle 4.0 has a number of larger feature changes that already impact many plugins, that we should change the list of supported browsers for Moodle 4.0 to remove support for Internet Explorer.

This is a decision that we originally proposed 18 months ago and it was agreed that we would drop support for IE11 from 3.9, and remove the polyfills and other tooling that allowed the support of IE11 from Moodle 3.10 onwards. We never actually removed these polyfills in 3.10 as we wanted to avoid modifying the compiled JS output but we are able to now. You can see MDLSITE-6109 for the detail of this discussion.

Now that we are required to make a change to compiled JS, it seems sensible to make this change at the same time.

I'm also proposing that we drop support for a very old version of the Android browser (4.4.4) whose last release was in June 2014 and which has very minimal usage.

By dropping support for both of these older browsers, we will stop injecting most of the support polyfills that we currently have into the code and you will be able to natively use and debug features like Promises, async, generators, for...of, and many others natively. This has a hugely positive impact upon the way in which you are able to debug JS code and follow sourcemaps.

Unfortunately this change will mean that if you run grunt on master/4.0+ and use that code on older versions of Moodle, it will not support those browser versions. The code should still work on Moodle, but some of your build tooling may complain about unbuilt changes if you actively run grunt or similar tooling against multiple Moodle versions. Likewise, if you build against Moodle 3.11 or earlier and check this code in, then this will cause errors when running grunt on the master/4.0 branches.

If this matters to you then you will need to fork your plugin for Moodle 4.0. Some of you may already be thinking about doing this for Moodle 4.0 given the breadth of other changes that you have to make for your plugin anyway.

If your organisation still cares about supporting IE11, then there are ways that you can re-insert the relevant polyfills as part of your deployment process (essentially update the .grunt/tasks/javascript.js file and update the IE support line, then run grunt amd).

If you have any feedback on this change, please let me know. This change is tracked in MDL-73915.

Best wishes,

Andrew Lyons
Principle Developer
Moodle LMS Team

Average of ratings: Useful (2)
In reply to Andrew Lyons

Re: Advanced notice of changes to JS Minification affecting supported stables for community developers

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Thanks Andrew.

It looks like you have thought this through very carefully, and chosen the path that achieves the most benefit, and causes the least pain for plugin developers. (In particular, I think it is right to do all these things at once, so then hopefully we can have a couple more years with no major changes.) Thank you for your hard work.
Average of ratings: Useful (2)
In reply to Andrew Lyons

Re: Advanced notice of changes to JS Minification affecting supported stables for community developers

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Would the TL:DR/Wild oversimplification be that from Moodle 4.0 The MS IE11 browser will not be supported without very special effort?
In reply to Marcus Green

Re: Advanced notice of changes to JS Minification affecting supported stables for community developers

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Mostly... IE hasn't been supported since 3.10, but this change actively breaks it.
Average of ratings: Useful (1)
In reply to Andrew Lyons

Re: Advanced notice of changes to JS Minification affecting supported stables for community developers

by Susanna Zanatta -

Hi Andrew,

Thanks for the detailed explanation.

If this change will actively break IE11, were screen-reader usage stats considered? 

According to a survey conducted by Web Aim in 2021, 3.3% of screen reader users use IE, and 1.9% of them used the JAWS+IE (https://webaim.org/projects/screenreadersurvey9/). JAWS is one of the most commonly used screen readers and not yet entirely compatible with Edge, so a few users may still rely on IE.

I would love to hear your thoughts on this as it looks like IE usage amongst screen reader users is higher than the global 0.6% market share mentioned in MDL-73915.

Thanks,

Susanna

In reply to Susanna Zanatta

Re: Advanced notice of changes to JS Minification affecting supported stables for community developers

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yes, but that was from June 2021, and look at the slop of the graph in https://webaim.org/projects/screenreadersurvey9/#browsers. That does not look like a gradual exponential decay to me, but rather a line heading almost straight to 0, and which has quite possibly hit it already. (From the slopes of the lines, it seems that people are mostly switching from IE to Edge, and lots of people have successfully made that transation.)

So, I think that was a good question to ask, but I don't think it is a good reason to change the plan.
Average of ratings: Useful (2)
In reply to Susanna Zanatta

Re: Advanced notice of changes to JS Minification affecting supported stables for community developers

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Susanna,

Although this wasn't a factor in this decision, I believe it's something that we considered in the original decision to drop support for IE back in August 2020.

It's worth pointing out that that the 3.3% is a very small number of real users, and it's people whose primary browser is Internet Explorer. JAWS does support other browsers, and often the support for those other browsers is actually now better than their support for IE.

As Tim points out, the graph on the survey shows a steady decline in the number of users using IE over past surveys and, by the time Moodle 4.0 is released, that number will be even smaller.

It's also worth pointing out that support for IE has dropped across the world. Microsoft have removed support for IE in their own products, including Outlook, Office 365, and Teams. Other major organisations have too, including YouTube, and Google.

Best wishes,

Andrew