Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Angular Templates or allow to disable rules more granular #21

Open
d-koppenhagen opened this issue Sep 30, 2024 · 0 comments
Open

Comments

@d-koppenhagen
Copy link

Currently this plugin expects to scan whole HTML pages which it does perfectly.
However, working with a frontend framework like Angular, HTML related to a component are not expected to be complete pages but component templates.
This in conclusion creates situations where some rules are not really applicable at component level since from the view of a component we don't know in which context they are used.

For example, the following component template would report the issues:

Accessibility Linter: All page content should be contained by landmarks
<article>
  <header>
    <h2>My Article</h2>
  </header>
  <div class="article-body" aria-label="Content">
    foo, bar
  </div>
</article>

It makes sense since the linter expects to scan a whole HTML page but not only a fragment.
To apply the specific rule, its necessary, to know the whole DOM / accessibility tree since we just don't know if or in which region the component is used.

The current workaround is to disable a rule globally by using a axe-linter.yml file:

# see: https://plugins.jetbrains.com/plugin/19498-accessibility-linter

# All rules: https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md
rules:
  region: false # disables region rule

However, this will globally disable the rule which is possibly not what we want.

Possible solutions

  1. Auto-detect Angular components and filter-out not applicable rules and add a config option for it
  2. Allow to disable rules using a comment (e. g. <!-- axe-linter-disable region -->)
  3. Allow to configure a filter in the axe-linter.yml for specific files

In my opinion option 2. would be the most flexible one and also it's a common solution for other tools such es ESLint, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant