Skip to content

fix(core): do not rename ARIA property bindings to attributes#64089

Closed
JeanMeche wants to merge 1 commit intoangular:20.3.xfrom
JeanMeche:aria-patch
Closed

fix(core): do not rename ARIA property bindings to attributes#64089
JeanMeche wants to merge 1 commit intoangular:20.3.xfrom
JeanMeche:aria-patch

Conversation

@JeanMeche
Copy link
Copy Markdown
Member

Patch port of #63925

#62630 made it so that all ARIA
property bindings would write to their corresponding attribute instead. The primary motivation for this change was to ensure that ARIA attributes were always rendered correctly on the server, where the emulated DOM may not correctly reflect ARIA properties as attributes. Furthermore, this change added support for binding to ARIA attributes using the property binding syntax (e.g. [aria-label]).

Unfortunately, #62630 relied on
the incorrect assumptions that an ARIA property name could be converted to its attribute name (without hardcoding the conversion), and that the value of an ARIA property matched its corresponding attribute. For example, the ariaLabelledByElements property's value is an array of DOM elements, while the corresponding aria-labelledby attribute's value is a string containing the IDs of the DOM elements.

This partially reverts #62630 so
that only property bindings with ARIA attribute names (begin with aria-) are converted to attribute bindings.

  • [ariaLabel] will revert to binding to the ariaLabel property.
  • [aria-label] will continue binding to the aria-label attribute.

angular#62630 made it so that all ARIA
property bindings would write to their corresponding attribute instead.
The primary motivation for this change was to ensure that ARIA
attributes were always rendered correctly on the server, where the
emulated DOM may not correctly reflect ARIA properties as attributes.
Furthermore, this change added support for binding to ARIA attributes
using the property binding syntax (e.g. `[aria-label]`).

Unfortunately, angular#62630 relied on
the incorrect assumptions that an ARIA property name could be converted
to its attribute name (without hardcoding the conversion), and that the
value of an ARIA property matched its corresponding attribute. For
example, the `ariaLabelledByElements` property's value is an array of
DOM elements, while the corresponding `aria-labelledby` attribute's
value is a string containing the IDs of the DOM elements.

This partially reverts angular#62630 so
that only property bindings with ARIA attribute names (begin with
`aria-`) are converted to attribute bindings.

* `[ariaLabel]` will revert to binding to the `ariaLabel` property.
* `[aria-label]` will continue binding to the `aria-label` attribute.

Note the only difference between `[aria-label]` and `[attr.aria-label]`
is that the former will attempt to bind to inputs of the same name while
the latter will not.
@pullapprove pullapprove bot requested a review from kirjs September 25, 2025 17:22
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Sep 25, 2025
@ngbot ngbot bot added this to the Backlog milestone Sep 25, 2025
@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 25, 2025
@AndrewKushnir AndrewKushnir removed the request for review from kirjs September 25, 2025 18:45
@kirjs
Copy link
Copy Markdown
Contributor

kirjs commented Sep 25, 2025

This PR was merged into the repository. The changes were merged into the following branches:

kirjs pushed a commit that referenced this pull request Sep 25, 2025
#62630 made it so that all ARIA
property bindings would write to their corresponding attribute instead.
The primary motivation for this change was to ensure that ARIA
attributes were always rendered correctly on the server, where the
emulated DOM may not correctly reflect ARIA properties as attributes.
Furthermore, this change added support for binding to ARIA attributes
using the property binding syntax (e.g. `[aria-label]`).

Unfortunately, #62630 relied on
the incorrect assumptions that an ARIA property name could be converted
to its attribute name (without hardcoding the conversion), and that the
value of an ARIA property matched its corresponding attribute. For
example, the `ariaLabelledByElements` property's value is an array of
DOM elements, while the corresponding `aria-labelledby` attribute's
value is a string containing the IDs of the DOM elements.

This partially reverts #62630 so
that only property bindings with ARIA attribute names (begin with
`aria-`) are converted to attribute bindings.

* `[ariaLabel]` will revert to binding to the `ariaLabel` property.
* `[aria-label]` will continue binding to the `aria-label` attribute.

Note the only difference between `[aria-label]` and `[attr.aria-label]`
is that the former will attempt to bind to inputs of the same name while
the latter will not.

PR Close #64089
@kirjs kirjs closed this Sep 25, 2025
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants