tagName); if ($tag === 'dialog') { return null; // Native handles modal state via showModal() } $role = strtolower(trim($element->getAttribute('role'))); if (!in_array($role, ['dialog', 'alertdialog'], true)) { return null; } if (!$element->hasAttribute('aria-modal')) { return $this->createViolation( $element, sprintf('Custom element with role="%s" is missing aria-modal="true" (or "false" for non-modal dialogs).', $role), 'Add aria-modal="true" on modal dialogs so assistive technologies constrain virtual cursor navigation inside the dialog.' ); } return null; } }