Anchor tag ada issue - Richtext component | Community
Skip to main content
Level 2
November 17, 2021
Solved

Anchor tag ada issue - Richtext component

  • November 17, 2021
  • 1 reply
  • 572 views

Hi Team,

 

This anchor field is generating the markup in the form:  <a  id = "name provided through authoring field"></a> - out of box behaviour of aem rich text component

Its throwing some ada compliance issue.

is there way to change a tag to span tag.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

Yes, in Sling Model, you can do something like this:

@Model(adaptables=Resource.class) public class MyTextComponent { @Optional @ValueMapValue @1497330(values = "") private String text; private String richText; @PostConstruct protected void init() { if (!text.isEmpty()) { richText = text.replaceAll("</?span>", ""); } } public String getRichText() { return richText; } }

in Sightly you can just call ${model.richText @ context='html'} 

1 reply

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 12, 2023

Yes, in Sling Model, you can do something like this:

@Model(adaptables=Resource.class) public class MyTextComponent { @Optional @ValueMapValue @1497330(values = "") private String text; private String richText; @PostConstruct protected void init() { if (!text.isEmpty()) { richText = text.replaceAll("</?span>", ""); } } public String getRichText() { return richText; } }

in Sightly you can just call ${model.richText @ context='html'}