Add nested component selector check, fix animation rule false positives
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -120,17 +120,29 @@ class NoAnimations_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
$is_allowed_element = false;
|
||||
}
|
||||
|
||||
// If hover effects on non-clickable elements, flag it
|
||||
// If hover effects on non-clickable elements contain position/size changes, flag it
|
||||
// Note: Color/background/opacity changes are allowed on any element (visual feedback)
|
||||
// Only position-altering properties are prohibited
|
||||
if (!$is_allowed_element && !empty($properties)) {
|
||||
$this->add_violation(
|
||||
$file_path,
|
||||
$line_num,
|
||||
"Hover effects on non-clickable elements are PROHIBITED",
|
||||
$selector,
|
||||
"Professional business applications must remain static like a PDF. Only buttons, links, form fields, images, and table rows may have hover effects. Remove hover effects from static elements.",
|
||||
'critical'
|
||||
);
|
||||
continue; // Skip further checks for this context
|
||||
$has_position_properties = false;
|
||||
foreach (array_keys($properties) as $property) {
|
||||
if (ScssContextParser::is_position_property($property) || str_starts_with($property, 'transform')) {
|
||||
$has_position_properties = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($has_position_properties) {
|
||||
$this->add_violation(
|
||||
$file_path,
|
||||
$line_num,
|
||||
"Position/size changes on hover for non-clickable elements are PROHIBITED",
|
||||
$selector,
|
||||
"Professional business applications must remain static. Remove position/size changes from hover states. Color, background, opacity, and other visual changes are allowed.",
|
||||
'critical'
|
||||
);
|
||||
continue; // Skip further checks for this context
|
||||
}
|
||||
}
|
||||
// Get base properties for comparison
|
||||
$base_selector = ScssContextParser::get_base_selector($selector);
|
||||
|
||||
Reference in New Issue
Block a user