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.5 KiB
PHP
75 lines
2.5 KiB
PHP
<?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 AriaComboboxPattern extends AbstractRule
|
||
|
|
{
|
||
|
|
public function getId(): string
|
||
|
|
{
|
||
|
|
return 'WCAG_4_1_2_ARIA_COMBOBOX';
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getDescription(): string
|
||
|
|
{
|
||
|
|
return 'Elements with role="combobox" must specify aria-expanded, aria-controls (or aria-owns), and an accessible name (WAI-ARIA 1.2).';
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getStandard(): WCAGStandard
|
||
|
|
{
|
||
|
|
return WCAGStandard::A;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getSeverity(): Severity
|
||
|
|
{
|
||
|
|
return Severity::ERROR;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getLevel(): int
|
||
|
|
{
|
||
|
|
return 3;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function check(DOMElement $element): ?Violation
|
||
|
|
{
|
||
|
|
if (strtolower(trim($element->getAttribute('role'))) !== 'combobox') {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
$missing = [];
|
||
|
|
|
||
|
|
if (!$element->hasAttribute('aria-expanded') || !in_array(strtolower(trim($element->getAttribute('aria-expanded'))), ['true', 'false'], true)) {
|
||
|
|
$missing[] = 'aria-expanded="true|false"';
|
||
|
|
}
|
||
|
|
|
||
|
|
$hasPopupRef = ($element->hasAttribute('aria-controls') && trim($element->getAttribute('aria-controls')) !== '')
|
||
|
|
|| ($element->hasAttribute('aria-owns') && trim($element->getAttribute('aria-owns')) !== '');
|
||
|
|
if (!$hasPopupRef) {
|
||
|
|
$missing[] = 'aria-controls="<popup-id>"';
|
||
|
|
}
|
||
|
|
|
||
|
|
$hasName = ($element->hasAttribute('aria-label') && trim($element->getAttribute('aria-label')) !== '')
|
||
|
|
|| ($element->hasAttribute('aria-labelledby') && trim($element->getAttribute('aria-labelledby')) !== '')
|
||
|
|
|| ($element->hasAttribute('title') && trim($element->getAttribute('title')) !== '')
|
||
|
|
|| ($element->hasAttribute('id') && trim($element->getAttribute('id')) !== '');
|
||
|
|
if (!$hasName) {
|
||
|
|
$missing[] = 'accessible name (aria-label / aria-labelledby / associated <label>)';
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!empty($missing)) {
|
||
|
|
return $this->createViolation(
|
||
|
|
$element,
|
||
|
|
'Combobox widget (role="combobox") is missing required WAI-ARIA 1.2 properties: ' . implode(', ', $missing) . '.',
|
||
|
|
'Add aria-expanded="false", aria-controls="<listbox-id>", and an accessible name to the combobox element.'
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|