Skip to content

Commit 0fb1642

Browse files
committed
fix: normalise opacity visibility check across all toolbar audits
1 parent 2dfea0d commit 0fb1642

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/view/frontend/web/js/toolbar/audits/buttons-without-type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
if (type !== null && type.trim() !== '') return false;
3131
if (!btn.offsetParent && getComputedStyle(btn).position !== 'fixed') return false;
3232
const style = getComputedStyle(btn);
33-
if (style.visibility === 'hidden' || style.display === 'none' || style.opacity === '0') return false;
33+
if (style.visibility === 'hidden' || style.display === 'none' || parseFloat(style.opacity) === 0) return false;
3434
return true;
3535
});
3636

src/view/frontend/web/js/toolbar/audits/empty-interactive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default {
2828
// Visibility check
2929
if (!el.offsetParent && getComputedStyle(el).position !== 'fixed') return false;
3030
const style = getComputedStyle(el);
31-
if (style.visibility === 'hidden' || style.display === 'none' || style.opacity === '0') return false;
31+
if (style.visibility === 'hidden' || style.display === 'none' || parseFloat(style.opacity) === 0) return false;
3232

3333
// Accessible name sources
3434
if (el.getAttribute('aria-label')?.trim()) return false;

src/view/frontend/web/js/toolbar/audits/images-without-dimensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default {
2626
const images = Array.from(document.querySelectorAll('img')).filter(img => {
2727
if (!img.offsetParent && getComputedStyle(img).position !== 'fixed') return false;
2828
const style = getComputedStyle(img);
29-
if (style.visibility === 'hidden' || style.display === 'none' || style.opacity === '0') return false;
29+
if (style.visibility === 'hidden' || style.display === 'none' || parseFloat(style.opacity) === 0) return false;
3030
return !img.hasAttribute('width') || !img.hasAttribute('height');
3131
});
3232

src/view/frontend/web/js/toolbar/audits/multiple-h1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default {
2727
const h1s = Array.from(document.querySelectorAll('h1')).filter(el => {
2828
if (!el.offsetParent && getComputedStyle(el).position !== 'fixed') return false;
2929
const style = getComputedStyle(el);
30-
if (style.visibility === 'hidden' || style.display === 'none' || style.opacity === '0') return false;
30+
if (style.visibility === 'hidden' || style.display === 'none' || parseFloat(style.opacity) === 0) return false;
3131
return true;
3232
});
3333

src/view/frontend/web/js/toolbar/audits/small-touch-targets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
if (el.matches('[disabled], [aria-disabled="true"]')) return false;
4646
if (!el.offsetParent && getComputedStyle(el).position !== 'fixed') return false;
4747
const style = getComputedStyle(el);
48-
if (style.visibility === 'hidden' || style.display === 'none' || style.opacity === '0') return false;
48+
if (style.visibility === 'hidden' || style.display === 'none' || parseFloat(style.opacity) === 0) return false;
4949

5050
const rect = el.getBoundingClientRect();
5151
return rect.width < MIN_SIZE || rect.height < MIN_SIZE;

src/view/frontend/web/js/toolbar/audits/unsafe-blank-target.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default {
3333
).filter(el => {
3434
if (!el.offsetParent && getComputedStyle(el).position !== 'fixed') return false;
3535
const style = getComputedStyle(el);
36-
if (style.visibility === 'hidden' || style.display === 'none' || style.opacity === '0') return false;
36+
if (style.visibility === 'hidden' || style.display === 'none' || parseFloat(style.opacity) === 0) return false;
3737

3838
const rel = (el.getAttribute('rel') || '').toLowerCase().split(/\s+/);
3939
return !rel.includes('noopener') && !rel.includes('noreferrer');

0 commit comments

Comments
 (0)