This commit is contained in:
Josh at WLTechBlog
2025-12-09 13:18:28 -07:00
parent 9079accb3b
commit 6ad3d6e40e
2 changed files with 16 additions and 0 deletions

BIN
daemon/cremotedaemon Normal file → Executable file

Binary file not shown.

View File

@@ -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);