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
75 lines
2.3 KiB
PHP
75 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace YakNet\AccessibilityConsole\Rules;
|
|
|
|
use DOMElement;
|
|
use DOMXPath;
|
|
use YakNet\AccessibilityConsole\Core\Severity;
|
|
use YakNet\AccessibilityConsole\Core\Violation;
|
|
use YakNet\AccessibilityConsole\Core\WCAGStandard;
|
|
|
|
class AriaTreePattern extends AbstractRule
|
|
{
|
|
public function getId(): string
|
|
{
|
|
return 'WCAG_4_1_2_ARIA_TREE';
|
|
}
|
|
|
|
public function getDescription(): string
|
|
{
|
|
return 'WAI-ARIA Tree widgets (role="tree") must have an accessible name and expandable treeitems must specify aria-expanded.';
|
|
}
|
|
|
|
public function getStandard(): WCAGStandard
|
|
{
|
|
return WCAGStandard::A;
|
|
}
|
|
|
|
public function getSeverity(): Severity
|
|
{
|
|
return Severity::WARNING;
|
|
}
|
|
|
|
public function getLevel(): int
|
|
{
|
|
return 4;
|
|
}
|
|
|
|
public function check(DOMElement $element): ?Violation
|
|
{
|
|
$role = strtolower(trim($element->getAttribute('role')));
|
|
|
|
if ($role === 'tree') {
|
|
$hasName = ($element->hasAttribute('aria-label') && trim($element->getAttribute('aria-label')) !== '')
|
|
|| ($element->hasAttribute('aria-labelledby') && trim($element->getAttribute('aria-labelledby')) !== '');
|
|
if (!$hasName) {
|
|
return $this->createViolation(
|
|
$element,
|
|
'Element with role="tree" is missing an accessible name (aria-label or aria-labelledby).',
|
|
'Add aria-label="File Explorer" or aria-labelledby referencing a visible heading.'
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
if ($role === 'treeitem') {
|
|
$doc = $element->ownerDocument;
|
|
if ($doc !== null) {
|
|
$xpath = new DOMXPath($doc);
|
|
$nestedGroup = $xpath->query('./*[@role="group"] | ./ul | ./ol', $element);
|
|
if ($nestedGroup !== false && $nestedGroup->length > 0 && !$element->hasAttribute('aria-expanded')) {
|
|
return $this->createViolation(
|
|
$element,
|
|
'Parent element with role="treeitem" contains nested child items without an aria-expanded attribute.',
|
|
'Add aria-expanded="true" or aria-expanded="false" to expandable treeitem nodes.'
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|