elements must have a non-empty label attribute.'; } public function getStandard(): WCAGStandard { return WCAGStandard::A; } public function getSeverity(): Severity { return Severity::ERROR; } public function getLevel(): int { return 2; } public function check(DOMElement $element): ?Violation { if (strtolower($element->tagName) !== 'optgroup') { return null; } if (!$element->hasAttribute('label') || trim($element->getAttribute('label')) === '') { return $this->createViolation( $element, $this->getDescription(), 'Add a descriptive label attribute to the element.' ); } return null; } }