This commit is contained in:
Josh at WLTechBlog
2025-12-09 14:58:00 -07:00
parent 77d1061ae7
commit 87e5e0555d
6 changed files with 159 additions and 41 deletions

View File

@@ -1,5 +1,39 @@
# Cremote Changelog
## Version 2.2.1-contrast-detection-fix (2025-12-09)
### Improvements: Enhanced Text Color Detection
This patch improves the text color detection algorithm to properly handle complex nested DOM structures.
#### What Changed
**Enhanced Recursive Search Algorithm:**
- Previous version checked only direct children
- New version recursively searches all descendant elements
- Finds the element with the most text content (ignores `<br>`, empty elements)
- Properly handles structures like `<a><span>text</span><br></a>`
**Example Fix:**
```html
<a style="color: rgb(12, 113, 195)">
<span style="color: #ffffff;">314-560-7171</span>
<br>
</a>
```
- **Before:** Used `<a>` color (blue) = 4.17:1 contrast ❌
- **After:** Uses `<span>` color (white) = 21.00:1 contrast ✅
**Modified Files:**
- `daemon/daemon.go` - Lines 9301-9354: Implemented recursive `findTextBearingElement()` function
**Version Updates:**
- Daemon: `2.2.1-contrast-detection-fix`
- MCP Server: `2.2.1-contrast-detection-fix`
- CLI: `2.2.1`
---
## Version 2.2.0-contrast-detection-fix (2025-12-09)
### Major Improvements: Contrast Detection
@@ -20,15 +54,15 @@ This release fixes three critical issues in the WCAG contrast checking functiona
3. **Child Element Text Color Detection**
- **Problem:** Tool used parent element's color (e.g., `<a>`) instead of child element's color (e.g., `<span>`)
- **Fix:** Added logic to check visible child elements and use their text color when present
- **Impact:** Accurate text color detection for complex DOM structures with styled child elements
- **Fix:** Added recursive search to find the descendant element with the most text content and use its color
- **Impact:** Accurate text color detection for complex DOM structures like `<a><span>text</span><br></a>`
### Technical Details
**Modified Files:**
- `daemon/daemon.go` - Lines 9152-9220: Enhanced `analyzeGradientContrast()` function
- `daemon/daemon.go` - Lines 9305-9340: Updated background detection logic
- `daemon/daemon.go` - Lines 9257-9322: Enhanced text color detection
- `daemon/daemon.go` - Lines 9301-9354: Enhanced text color detection with recursive search
**Version Updates:**
- Daemon: `2.2.0-contrast-detection-fix`