Suppressing Rich Text Editor XHtml validator in a multi-tenant XM instance

In one of the projects that I have been working lately, there was an issue with Sitecore Rich Text Editor XHTML validator, wherein the validator was throwing error messages about some aria labels, video id attributes that were added to the HTML section of the Rich Text Editor directly.

Attributes that threw error message by the validator are:

  • aria-label
  • role
  • data-video-id

The project is a Sitecore Headless multi-tenant project where a lot of projects share the same XM instance for their content management.

For those that you don't know, Sitecore Rich Text Editor (RTE) field has out of the box XHTML validation attached to it that does the validation of the html data that is entered into the RTE field.










There are tons of posts online about removing the XHTML validator in the XM instance.

Unfortunately, this option did not work out for us as our XM instance is multi-tenant.

Though the XHtml validator works for any content that you enter into the text area of the Rich Text Editor, it will start to fail when you start editing the HTML content of the RTE directly.

While looking for alternate solutions, I found this question on Sitecore stack exchange where it talks about Sitecore's ability to suppress certain validation rules at the template or content item level.

Sitecore documentation talks about it as well - https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/the-validation-options.html.

It is called "Suppressed Validation Rules" and you can find it in the Validation section when you select 'Standard fields" in the View menu.























You just need to add the Item ID of the XHtml Validator that we saw in the first screenshot above - {CB57D0E7-5202-4C3D-838B-314F2B95A2CB} into the Suppressed validation rules of your content page template __standard values.

What does this is to suppress the XHtml validation rules from firing for any Rich Text Editor fields in that page.

Please note that there are few answers in the Stack exchange question where they'll tell you to add this into the Suppressed validation rules text box - Full Page XHtml, Item ID {9DE34911-96D5-48C3-AFFF-20CFF4D5AB02}

This answer did not work for me and only entering the Item ID GUID seem worked.

The other options that were considered are:

  1. Extend the schema - You can extend the XHtml schema to include these custom attributes. But it will not lend itself well in a multi-tenant setup and planning to move to XM cloud.
  2. Use multiline text field instead of Rich Text Editor - As you may know, both Multiline text field and Rich Text Editor use the same text file behind the scenes. We decided to stick with RTE due to other business reasons. Nonetheless this will be a valid option to explore if you don't want the validator firing and failing on your formatted or more advanced html in your content.

Comments