[feature request]: Allow aria-label to suppress template-accessibility-elements-content violation

Offen
#993 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
angular, typescript

Rechercherichtung

Beginne damit, die Implementierung und Tests für die Regel template-accessibility-elements-content zu finden, und reproduziere dann das gemeldete Button-Beispiel mit aria-label. Ermittle, ob aria-label standardmäßig oder über eine Regeloption akzeptiert werden sollte, und aktualisiere das relevante Verhalten und die Tests, sodass das Beispiel keinen Verstoß mehr meldet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Describe the bug

I'm facing an issue when I don't want to set explicit text content for a button element but I want to use aria-label for assistive technologies instead. In my current situation, I have a directive that adds icons to the button but without text.

Would it be possible for template-accessibility-elements-content to consider aria-label to be an acceptable alternative (either by default or as a rule option)?

Context and configuration

Please share:

  • Which rule is causing the problem
    template-accessibility-elements-content
  • What's the content of your tsconfig.json
{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "importHelpers": true,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "target": "ES2015",
    "module": "ESNext",
    "typeRoots": ["node_modules/@types"],
    "lib": ["ES2018", "DOM"]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true,
    "enableIvy": true
  }
}
  • What's the content of ~/.codelyzer.js (if applicable)
    I do not have it.

Expected behavior

<button class="btn-close" aria-label="close></button> should NOT produce an error.

Additional context

I believe a similar question about "aria-label" support might be raised to all others template-accessibility-* rules.

Vorherrschende Sprache
TypeScript
Sterne
2.5k
Forks
232
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus mgechev/codelyzer

Alle Issues in mgechev/codelyzer

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.