Repository navigation
fix(button): keep aria-label set outside igxLabel - master - #18055
Merged
Merged
Conversation
The aria-label host binding wrote null when igxLabel was unset, which removed any aria-label the template set (regression from #17155). The button now writes aria-label only through igxLabel and restores the element's own value when igxLabel is cleared. Label styles now skip .igx-button, so igxLabel on a button no longer gets the IgxLabelDirective styles. The button's igxLabel input is deprecated in favor of aria-label. Closes #18009
This was referenced Nov 25, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Clearing igxLabel can overwrite a newer native aria-label or retain a stale server-rendered label after hydration, leaving buttons with incorrect or missing accessible names.
2 open issues
What changed in this PR
Addresses #18009 by preserving button accessibility labels and preventing label-theme styles from changing button colors. It also deprecates the button’s igxLabel input in favor of native aria-label.
Changes:
- Replaces the button’s
aria-labelhost binding with conditional attribute updates and restoration. - Excludes
.igx-buttonfrom label styles without increasing selector specificity. - Updates button-group bindings, regression tests, API documentation, and release notes.
| File | Description |
|---|---|
projects/igniteui-angular/directives/src/directives/button/README.md |
Documents igxLabel deprecation. |
projects/igniteui-angular/directives/src/directives/button/button.directive.ts |
Changes accessible-label updates and fallback restoration. |
projects/igniteui-angular/directives/src/directives/button/button.directive.spec.ts |
Adds label preservation, update, and clearing tests. |
projects/igniteui-angular/core/src/core/styles/components/label/_label-theme.scss |
Excludes buttons from scoped label theme tokens. |
projects/igniteui-angular/core/src/core/styles/components/label/_label-component.scss |
Excludes buttons from label structural styles. |
projects/igniteui-angular/button-group/src/button-group/button-group-content.component.html |
Binds button labels through native aria-label. |
CHANGELOG.md |
Records the deprecation and button fixes. |
Review effort: Balanced
Drop the snapshot and restore of the element's own aria-label. Clearing igxLabel now removes the attribute only if it still holds the value igxLabel wrote, so a newer native aria-label is kept and a hydrated server value is not mistaken for an authored one.
kdinev
approved these changes
Nov 25, 2026
kdinev
enabled auto-merge (squash)
November 25, 2026 14:11
5 of 23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #18009
Description
igxButtonno longer removes anaria-labelset on the button. The[attr.aria-label]host binding is gone. The button writesaria-labelwithRenderer2only whenigxLabelhas a value. WhenigxLabelis cleared, it removesaria-labelonly if the attribute still holds the valueigxLabelwrote, so a newer nativearia-labelis kept and a server-rendered value isn't mistaken for an authored one.The label styles (
[igxLabel]base rule, tokens and typography) now skip.igx-button. The selector is[igxLabel]:where(:not(.igx-button)), so specificity stays at (0,1,0).The button's
igxLabelinput is deprecated in favor of the nativearia-label. The button group now binds[attr.aria-label]instead of[igxLabel]; its rendered output is the same.Motivation / Context
Since 22.2.0 (#17155), the host binding wrote
nullwhenigxLabelwas unset, so Angular removed anyaria-labelthe template set, static,i18n-aria-labelor bound. Before that, the button setaria-labelonly whenigxLabelhad a value, as 21.2.x still does.The button's
igxLabelinput shares its name with the[igxLabel]selector ofIgxLabelDirective. A button written asigxLabel="...", as the button's JSDoc shows, matched the label CSS and took the label text color. #17987 made this visible, because the label styles are now kept whenigx-labelis excluded but an included component depends on it.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Button, Button Group, Theming (label)
How Has This Been Tested?
New specs in
button.directive.spec.tscover a staticaria-label, a boundaria-label, noaria-labelat all,igxLabelsetting and updatingaria-label, replacing a staticaria-labelwhile set, clearingigxLabelafter a newer nativearia-label, and clearing it after hydration. Three of them failed before the fix. The button, button group and input group specs andnpm run test:stylespass. In the full library run, the only failure is the hierarchical grid test "should skip nested child grids that have no data", which also fails on master.I compiled the light and dark Material, Indigo, Bootstrap and Fluent presets before and after. The only changes are the
[igxLabel]selectors (base, tokens, RTL and typography rules).I also ran an app that reported the issue against a local build, with SSR. The server HTML has the
aria-labelfromi18n-aria-label, and a button that usesigxLabelgets itsaria-labelon the server as well. After hydration both keep theiraria-labeland the button colors, and there are no hydration warnings.Test Configuration:
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)