Skip to content

Commit

Permalink
Merge pull request #57 from khiga8/aja/double-alt-text-bug
Browse files Browse the repository at this point in the history
fix: applies alt text only once
  • Loading branch information
andrialexandrou authored Jan 27, 2025
2 parents 14c2cdf + bd137c0 commit 7affdfd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ function validateImagesWithAnchorParent(parent, image) {
image.classList.add("github-a11y-img-invalid-alt");
}

if (parent.querySelector('.github-a11y-img-caption')) {
return;
}
const subtitle = createSubtitleElement();
parent.classList.add("github-a11y-img-container");

Expand All @@ -127,6 +130,9 @@ function validateImagesWithNonAnchorParent(parent, image) {
if (invalidAltText(altText)) {
image.classList.add("github-a11y-img-invalid-alt");
}
if (parent.querySelector('.github-a11y-img-caption')) {
return;
}
const subtitle = createSubtitleElement();
parent.classList.add("github-a11y-img-container");

Expand Down

0 comments on commit 7affdfd

Please sign in to comment.