WP Rocket's LCP detection script incorrectly selects images with opacity: 0 as LCP candidates because it only checks width and height but ignores visibility properties like opacity and visibility.
Expected: The visible image should be detected as LCP
Actual Bug: The hidden image (opacity: 0) is being detected as LCP
Real example: belivria.com
GitHub Issue: This template should be used to create a GitHub issue for fixing the LCP detection logic.
This simulates the exact issue from belivria.com where hover reveals a hidden image.
This image has style="opacity: 0" and should NOT be detected as LCP.
This image has style="visibility: hidden" and should NOT be detected as LCP.
This image has style="display: none" and should NOT be detected as LCP.
This image has style="opacity: 0.01" and should NOT be detected as LCP.
This image is fully visible and SHOULD be detected as LCP if it's the largest.
data-test="visible-image-1" or data-test="fully-visible" as LCPdata-test="hidden-image-1" or other hidden images as LCPThe LCP detection script should check for:
opacity > 0 (or a reasonable threshold like 0.1)visibility !== 'hidden'display !== 'none'File Location: /wp-content/rocket-test-data/templates/lcp-opacity-zero-bug.php
Issue Context: Based on belivria.com where WP Rocket detected bez-imeni-1-22-350x350.jpg instead of screenshot_3-5-350x350.png
Root Cause: LCP detection only checks element dimensions but ignores CSS visibility properties
Related Code: Check inc/Engine/Media/AboveTheFold/Frontend/Controller.php around line 129