• Hi,

    The System is running on WordPress 5.4 and is using the Avada-Theme(8.7)

    I am trying to add a aria-label or data-label attribute to some titles(h2s) in my blogposts so i can use an alternative title via Javascript.
    When I am adding either an aria-label or data-label to a title, the Gutenberg Editor recognizeses this block as incorrect html (“This block contains unexpected or invalid content”) and won`t show the normal block. Even tho it should still be considered correct HTML?

    So i am not really sure if this is a bug or wanted behaviour. If it is the desired behaviour, is there a way to add an alternative title to a title without loosing the normal presentation of the block in the Gutenberg editor or is there a possiblilty to disable the feature that detects incorrect HTML?

    If it is helpful, I found one topic about kind of the same issue in a different use case here: https://www.ads-software.com/support/topic/disable-warning-this-block-contains-unexpected-or-invalid-content-in-html-bloc/#post-13249461

    Greetings & Looking forward to an answer

Viewing 1 replies (of 1 total)
  • Plugin Author Riad Benguella

    (@youknowriad)

    Hi There!

    That’s correct behavior, the reason being if you add custom HTML to blocks that don’t know how to edit that HTML, you might lose it on future edits. So unless the Heading block supports editing these labels, it will create a block invalidation message.

    That said, for these situations where you want to tweak the HTML precisely, I suggest you avoid using the Heading block and use the custom HTML block instead.

    I hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘“This block contains unexpected or invalid content” when adding aria-label’ is closed to new replies.