Class attributes get stripped from html elements

When I add the following in a Static HTML module body:

<div class="img-wrapper"> <figure> <img class="content-img" src="image.jpg" alt="grey image"/> </figure></div> 

Then I close the page and re-open it it will suddenly be changed to the following automatically:

<div> <figure> <img src="image.jpg" alt="grey image" /> </figure></div>

I have never experienced this before, but this issue currently affects all my pages. Is there a workaround or is this a temporary bug?

Hi Jon,

Welcome to the Prismic community.

I'm not sure I've understood the issue. Can you please tell us where you are trying to add this static HTML code? are trying to add this to a field? What kind of Prismic field.

More importantly, It would be helpful to explain to us the use-case you are trying to implement.

Looking forward to your reply,
Fares

Hi Fares,

Thank you for the reply.

I'm using a static html module in the standard Prismic page editor. I'm making a simple article page. Now and then I need a custom element and will insert it using standard html code. We have used this for many pages previously and the bug seems to affect all pages we have in the system. The bug first arose two days ago and it started deleting all class attributes from all my html elements. See attached screenshot.

1 Like

Thank you for the clarifications; actually, this is not a way that we recommend, and It is possible that stripping those classes is related to some security fixes that we have deployed recently.

Anyway, I have created an issue to investigate this, but I don't think that we are going to fix it in the future, but we will let you know in case of any updates.

You can also use Slice variation feature to give content writers some flexibility, but all depends on the use-case you are implementing.

Please let us know if you have any other questions,
Fares

Hi Fares,

Is there any updates on this issue? Can you let us know if this is going to be fixed or not?

Thanks