[feature request]: Allow aria-label to suppress template-accessibility-elements-content violation
- Dominant language
- TypeScript
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
**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**
`
Contributor guide
Research direction
Start by locating the implementation and tests for the template-accessibility-elements-content rule, then reproduce the reported button example with aria-label. Determine whether aria-label should be accepted by default or through a rule option, and update the relevant behavior and tests so the example no longer reports a violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- accessibility, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100