Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat(v4.0.0): 175 WCAG 2.2 & ARIA rules, VPAT 2.5, 11 presets, PolicyEngine, inline suppressions, cache, CI generator, PHPUnit assertions, and open-source YakNet identity
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Rules;
|
||||
|
||||
use DOMElement;
|
||||
use YakNet\AccessibilityConsole\Core\Severity;
|
||||
use YakNet\AccessibilityConsole\Core\Violation;
|
||||
use YakNet\AccessibilityConsole\Core\WCAGStandard;
|
||||
|
||||
class MotionAnimationReduced extends AbstractRule
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'WCAG_2_3_3_REDUCED_MOTION';
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Stylesheets defining CSS animations or keyframes should respect the prefers-reduced-motion media query (WCAG 2.3.3).';
|
||||
}
|
||||
|
||||
public function getStandard(): WCAGStandard
|
||||
{
|
||||
return WCAGStandard::AAA;
|
||||
}
|
||||
|
||||
public function getSeverity(): Severity
|
||||
{
|
||||
return Severity::WARNING;
|
||||
}
|
||||
|
||||
public function getLevel(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public function check(DOMElement $element): ?Violation
|
||||
{
|
||||
if (strtolower($element->tagName) !== 'style') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$css = $element->textContent;
|
||||
if (trim($css) === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$hasAnimation = (bool)preg_match('/@keyframes\b|\banimation(?:-name)?\s*:\s*(?!none\b)/i', $css);
|
||||
$hasReducedMotion = (bool)preg_match('/prefers-reduced-motion/i', $css);
|
||||
|
||||
if ($hasAnimation && !$hasReducedMotion) {
|
||||
return $this->createViolation(
|
||||
$element,
|
||||
'Stylesheet defines CSS animations without a @media (prefers-reduced-motion: reduce) fallback (WCAG 2.3.3).',
|
||||
'Add @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }.'
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user