diff --git a/daemon/cremotedaemon b/daemon/cremotedaemon old mode 100644 new mode 100755 index 13d7e2b..8b0b595 Binary files a/daemon/cremotedaemon and b/daemon/cremotedaemon differ diff --git a/daemon/daemon.go b/daemon/daemon.go index 897405a..a4cda9a 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -9224,6 +9224,22 @@ func (d *Daemon) checkContrast(tabID string, selector string, timeout int) (*Con const text = element.textContent.trim(); if (!text || text.length === 0) return; + // Skip container elements that don't have direct text nodes + // This prevents checking parent DIVs when we should check the actual text elements (H2, P, etc.) + const hasDirectTextContent = Array.from(element.childNodes).some(node => + node.nodeType === Node.TEXT_NODE && node.textContent.trim().length > 0 + ); + + // For container elements (div, span), only check if they have direct text + // For semantic text elements (h1-h6, p, a, button, etc.), always check + const isSemanticTextElement = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'P', 'A', 'BUTTON', 'LABEL', 'LI', 'TD', 'TH'].includes(element.tagName); + const isContainerElement = ['DIV', 'SPAN'].includes(element.tagName); + + if (isContainerElement && !hasDirectTextContent) { + // Skip this container - its children will be checked separately + return; + } + // Get computed styles const style = window.getComputedStyle(element);