diff --git a/CHANGELOG.md b/CHANGELOG.md
index a667169e..ee4cba41 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ You need to
- Use hidden attribute to show/hide expiry notices instead of just CSS
- Only use dialog role for table of contents when it behaves like one (accessibility fix)
- Prevent interactive elements being obscured by sticky table of contents header
+- Only wrap images with alt text in hyperlinks
## 3.5.0
diff --git a/lib/govuk_tech_docs/tech_docs_html_renderer.rb b/lib/govuk_tech_docs/tech_docs_html_renderer.rb
index f9f2d614..31b47c4d 100644
--- a/lib/govuk_tech_docs/tech_docs_html_renderer.rb
+++ b/lib/govuk_tech_docs/tech_docs_html_renderer.rb
@@ -19,8 +19,12 @@ def header(text, level)
%(#{text}\n)
end
- def image(link, *args)
- %(#{super})
+ def image(link, title, alt_text)
+ if alt_text && !alt_text.strip.empty?
+ %(#{super})
+ else
+ super
+ end
end
def table(header, body)