Fix for hidden elements
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user