Skip to content

Commit

Permalink
Merge pull request #6 from Ruchika4/accessibility
Browse files Browse the repository at this point in the history
wip
  • Loading branch information
Ruchika4 authored Sep 26, 2023
2 parents d9c85b9 + 31582cb commit 9c9ceb4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libs/blocks/preflight/panels/accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ async function checkAlt() {
const imageDetail = {};
if (!image.hasAttribute('alt')) {
altMissing = true;
imageDetail.src = image.getAttribute('src');
imageDetail.src = image.hasAttribute('src') ? image.getAttribute('src').split('?')[0] : 'No image src';
imageDetail.altAttr = 'missing';
imageDetail.altAttrValue = 'missing';
} else {
const resp = await fetch(image.alt, { method: 'HEAD' });
if (!resp.ok) {
altValueMissing = true;
imageDetail.src = image.getAttribute('src');
imageDetail.src = image.hasAttribute('src') ? image.getAttribute('src').split('?')[0] : 'No image src';
imageDetail.altAttrValue = 'missing';
imageDetail.altAttr = 'Exist';
}
}
altValue.push(imageDetail);
Expand All @@ -34,7 +36,7 @@ async function checkAlt() {
if (altValue.length) {
imageGridHtml = "<table border='1|1'>";
imageGridHtml += '<tr>';
imageGridHtml += '<th class=preflight-content-heading>Image rc</th>';
imageGridHtml += '<th class=preflight-content-heading>Image</th>';
imageGridHtml += '<th class=preflight-content-heading>Alt Attribute</th>';
imageGridHtml += '<th class=preflight-content-heading>Alt Value</th>';
imageGridHtml += '</tr>';
Expand All @@ -49,7 +51,6 @@ async function checkAlt() {
}
imageGridHtml += '</table>';
}
console.log(imageGridHtml);

if (altMissing && altValueMissing) {
result.icon = fail;
Expand Down

0 comments on commit 9c9ceb4

Please sign in to comment.