govspeak icon indicating copy to clipboard operation
govspeak copied to clipboard

Update acronym alt text function to not target acronyms within HTML tags

Open owenatgov opened this issue 3 years ago • 0 comments

What

Updates the function add_acronym_alt_text to not target acronyms in use within html tag attributes eg:

When our acronym is EIF, the updated function will target

<p>#EIF</p>

...but won't target

<a href="#EIF">a link</a>

Why

Details of issue and proposed solution can be found in https://govuk.zendesk.com/agent/tickets/4819383

This is not a perfect solution as it does not solve instances of acronyms with a hash suffix within a tag's attributes in locations other than right at the start of a given attribute. For example it won't catch:

<a href="/my-page#EIF">a link</a>

owenatgov avatar Dec 31 '21 12:12 owenatgov