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

Skip to content

Add compiler diagnostic for conflicting ARIA bindings ([attr.aria-*] vs [ariaX]) #63746

@SkyZeroZx

Description

@SkyZeroZx

Which @angular/* package(s) are relevant/related to the feature request?

@angular/compiler-cli

Description

Currently in Angular, it is possible to bind both [attr.aria-] (direct HTML attribute) and [ariaX] (DOM property) on the same element. When both bindings exist for the same ARIA attribute, Angular silently prioritizes [attr.aria-] and ignores the [ariaX] binding. This can cause unexpected behavior and developer confusion.

Proposed Feature:
Introduce a compiler diagnostic that detects and warns when both [attr.aria-*] and [ariaX] bindings target the same ARIA attribute.

<div [attr.aria-label]="'Here label'" 
     [ariaLabel]="'Test label '">
</div>

Similar behavior also occurs with multiple repeated input bindings.

Proposed solution

Add diagnostic

Alternatives considered

Only working for duplicate inputs don't allow more specify case

https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-duplicate-attributes.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerIssues related to `ngc`, Angular's template compiler

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions