diff --git a/daemon/daemon.go b/daemon/daemon.go index 9ed0017..66cfdd1 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -9226,6 +9226,21 @@ func (d *Daemon) checkContrast(tabID string, selector string, timeout int) (*Con // Get computed styles const style = window.getComputedStyle(element); + + // Skip elements that are not visible (WCAG only applies to visible content) + // Check for display: none, visibility: hidden, opacity: 0 + if (style.display === 'none' || + style.visibility === 'hidden' || + parseFloat(style.opacity) === 0) { + return; + } + + // Also skip if element has no dimensions (effectively hidden) + const rect = element.getBoundingClientRect(); + if (rect.width === 0 || rect.height === 0) { + return; + } + const fgColor = style.color; const fontSize = style.fontSize; const fontWeight = style.fontWeight;