Skip to content

feat(core): render ARIA property bindings as attributes #62630

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

leonsenft
Copy link
Contributor

Allow binding to ARIA attributes using property binding syntax without the attr. prefix. For example, [aria-label]="expr" is now valid, and equivalent to [ariaLabel]="expr". Both examples bind to either a matching input or the aria-label HTML attribute, rather than the ariaLabel DOM property.

Binding ARIA properties as attributes will ensure they are rendered correctly on the server, where the emulated DOM may not correctly reflect ARIA properties as attributes.

@leonsenft leonsenft requested a review from AndrewKushnir July 14, 2025 16:31
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Jul 14, 2025
@ngbot ngbot bot added this to the Backlog milestone Jul 14, 2025
Copy link
Member

@JeanMeche JeanMeche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect at least to have some new compliance tests (probably in packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings).

@pullapprove pullapprove bot requested review from jelbourn and josephperrott July 16, 2025 01:44
@leonsenft
Copy link
Contributor Author

I would expect at least to have some new compliance tests (probably in packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_bindings).

Good suggestion, thanks. Done!

@leonsenft leonsenft requested review from crisbeto, AndrewKushnir and JeanMeche and removed request for jelbourn and josephperrott July 16, 2025 01:55
@pullapprove pullapprove bot requested review from jelbourn and josephperrott July 16, 2025 01:55
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-for: fw-security

Allow binding to ARIA attributes using property binding syntax _without_
the `attr.` prefix. For example, `[aria-label]="expr"` is now valid, and
equivalent to `[ariaLabel]="expr"`. Both examples bind to either a
matching input or the `aria-label` HTML attribute, rather than the
`ariaLabel` DOM property.

Binding ARIA properties as attributes will ensure they are rendered
correctly on the server, where the emulated DOM may not correctly
reflect ARIA properties as attributes.

Reuse the DOM schema registry from the compiler to map property names in
type check blocks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime detected: feature PR contains a feature commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants