From 0c8622294b2b8c335874a599d483308a5258c9c3 Mon Sep 17 00:00:00 2001 From: Josh at WLTechBlog Date: Tue, 9 Dec 2025 11:48:45 -0700 Subject: [PATCH] Fix for hidden elements --- daemon/daemon.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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;