From e88342159b6b9b77d5d37d926a88e40cae94a807 Mon Sep 17 00:00:00 2001 From: Marcus Date: Sun, 5 Jan 2025 04:59:00 -0800 Subject: [PATCH] ignore empty alt attr --- src/features/accesskit/visible_alt_text.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/accesskit/visible_alt_text.js b/src/features/accesskit/visible_alt_text.js index 9ed2a2666..4e7a2a627 100644 --- a/src/features/accesskit/visible_alt_text.js +++ b/src/features/accesskit/visible_alt_text.js @@ -26,8 +26,10 @@ const processImages = function (imageElements) { const imageBlocks = new Map(); imageElements.forEach(imageElement => { const { alt } = imageElement; - const imageBlock = imageElement.closest(imageBlockSelector); - imageBlocks.set(imageBlock, alt); + if (alt) { + const imageBlock = imageElement.closest(imageBlockSelector); + imageBlocks.set(imageBlock, alt); + } }); for (const [imageBlock, alt] of imageBlocks) {