Try our conversational search powered by Generative AI!

TinyMCE and WCAG 2.0 compliance in EpiServer


Our team has been asked to work on conforming to Web Content Accessibility Guidelines (2.0 at level AA), and ran into an issue with the TinyMCE control output in EpiServer.  The table editor in TinyMCE shows a "Border" field, which defaults to 0, but always adds a border="x" attribute to the table.  For instance, if you keep the default of zero, the markup produces this:

Unfortunately, that border attribute is not supported in HTML 5.  And this gets flagged by our compliance checking software (SortSite).

We found the TinyMCE script in the following path of our solutions: modules\_protected\CMS\\Util\Editor\tinymce

In EpiServer CMS versions 8 and 10 we can see that the TinyMCE version is  According to the TinyMCE site, their version 4 is accessible and also has a built in accessibility checker.  And version 4 doesn't append that deprecated border attribute to their borders.  Here is a link to their demo page.

Can we upgrade our version of TinyMCE to version 4?  Or can the TinyMCE version 4 control be added to the next version of EpiServer?  Thanks.

Edited, Jan 18, 2017 17:07

Thanks for the guidance Johan.  I've been struggling with this today.  Still don't have it working.  Initially I just added a class and tried his code verbatim.

But when I edit a page, and select the "All Properties" button to see the control, the following error appears:

Failed to load: /Util/Editor/tinymce/plugins/OptimizedEditor/editor_plugin.js?moduleArea=Util

I'll keep hammering on this tomorrow.

Jan 19, 2017 22:54

To get rid of the script error you can set ServerSideOnly = true in TinyMCEPluginNonVisual.

Jan 20, 2017 10:02

Thanks Johan!  That worked.  The ServerSideOnly property is documented (link below for other devs), I just didn't see it.  So now I just need to incorporate the the right combination of valid_elements.

Jan 20, 2017 13:23

Is there a way to remove the displayed fields in the table management dialog as well?  I was able to successfully strip away obsolete table markup attributes (like border) via EditorInitConfigurationOptions.  But the table management dialog in the editor still shows those fields.  Here is my class:

using EPiServer.Editor.TinyMCE;

namespace epiTroubleShooting.Helpers

    /// <summary>
    /// This class tweaks the TinyMCE settings.  Originally added for WCAG compliance.
    /// </summary>
        ServerSideOnly = true,
        AlwaysEnabled = true,
        PlugInName = "TinyMCECustomizer",
        DisplayName = "Custom editor init options",
        Description = "Loads custom editor init options.",
        EditorInitConfigurationOptions = @"{
            body_class : ""module-text"",
            paste_auto_cleanup_on_paste : true,
            theme_advanced_resizing : false,
            theme_advanced_blockformats : ""h2,h3,h4,h5,h6,p"",
            valid_elements : ""@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|
    public class TinyMCECustomizer


Thanks again for your help.

Edited, Jan 24, 2017 15:04
<p></p> <p>I don't think that's possible, without adding your own plugins or changing the plugins that ships with Episerver&nbsp;(which might get overwritten when upgrading Episerver).</p> <p></p>
Jan 24, 2017 15:13

Please note that body_class only works in All Properties view, not on on-page-edit view. This is a bug that will not get fixed, for some weird reason. I solved it by removing ServerSideOnly and then added this script in /util/editor/tinymce/plugins/{name of your plugin, in this case TinyMCECustomizer}/editor_plugin.js:

(function (tinymce, $) {
	tinymce.create('tinymce.plugins.OptimizedEditor', {
		init: function (ed, url) {
			ed.onLoad.add(function (editor) {
				// We can't use editor.settings.body_class unfortunately
				editor.dom.addClass('body'), 'text');
	tinymce.PluginManager.add('optimizededitor', tinymce.plugins.OptimizedEditor);
}(tinymce, epiJQuery));
Jan 24, 2017 15:18

Thanks so much Johan. So it's just a current limitation. I'll pass this along to our team so they can inform our clients. At least we can strip out the unwanted attributes. I hope that in the future EpiServer upgrades TinyMCE to version 4. That would solve this dilemma. WCAG compliance is something that we are increasingly seeing our clients request.

One last question on this, is it possible to intercept the post when a page edit occurs, so that we can programmatically parse the markup? I've got a request to inject some classes. Thanks.

Jan 24, 2017 15:58

Yes, you have IContentEvents you can subscribe to, please see this blog

Jan 24, 2017 16:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.