Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[interactive-supports-focus] allow specifying directives in allowListΒ #1996

@forivall

Description

@forivall

Description and reproduction of the issue

Some directives provide the accessibility features that are otherwise reported by interactive-supports-focus and click-events-have-key-events. It should be possible to allowlist elements with these directives.

{
  "rules": {
    "@angular-eslint/template/click-events-have-key-events": [
      "error",
      {
        "allowList": [
          "[mat-tab-link]"
        ]
      }
    ],
    "@angular-eslint/template/interactive-supports-focus": [
      "error",
      {
        "allowList": [
          "[mat-tab-link]"
        ]
      }
    ]
  }
}

(based on "Tabs and navigation" example)

<nav mat-tab-nav-bar [backgroundColor]="background">
  <a
    mat-tab-link
    *ngFor="let link of links"
    (click)="activeLink = link"
    [active]="activeLink == link"
  >
    {{link}}
  </a>
  <a mat-tab-link disabled>Disabled Link</a>
</nav>

Versions

package version
@angular-eslint/eslint-plugin-template 17.5.2
@angular-eslint/template-parser 17.5.2
@typescript-eslint/parser 5.62.0
ESLint 8.57.0
node 20.13.1
# Please run `npx ng version` in your project and paste the full output here:
Angular CLI: 17.3.8
Node: 20.13.1
Package Manager: npm 10.5.2
OS: darwin arm64

Angular: 17.3.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.8
@angular-devkit/build-angular   17.3.8
@angular-devkit/core            17.3.8
@angular-devkit/schematics      17.3.8
@angular/cdk                    17.3.10
@angular/cli                    17.3.8
@angular/material               17.3.10
@schematics/angular             16.2.10
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.13.3

This is a feature request for something that is not supported by the latest version, and I cannot upgrade versions in the project, so this is not really applicable

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions