fix(packages): only remove aria-hidden when an accessibility prop is set (#5347)

* Adjust accessibility behaviour for title elements

* Adjust angular package as well

* Fix types

* fix(packages/angular): use fixture.whenStable instead of triggering change detection manually

detectChanges() explicitly forces a check, so it can mask missing automatic change detection

* test(packages/angular): add test for non-signal bound aria attribute

* fix(angular): preserve explicit aria-hidden and support input bindings

---------

Co-authored-by: Karsa <contact@karsa.org>
This commit is contained in:
Eric Fennis
2026-12-01 12:56:09 +01:00
committed by GitHub
co-authored by Karsa
parent 475eff7532
commit 8cd4f293f2
31 changed files with 570 additions and 53 deletions
+4 -4
View File
@@ -23,13 +23,13 @@ Only if an icon **conveys essential meaning on its own** should it be made acces
## Making an icon accessible
To expose an icon to assistive technologies, provide an accessible name by passing a `title` element as a child or passing the `aria-label` prop to the icon component.
To expose an icon to assistive technologies, provide an accessible name by passing the `aria-label` prop to the icon component, or by passing a `title` element as a child and referencing it with `role="img"` and `aria-labelledby`.
This removes the `aria-hidden` attribute and makes the icon visible to screen readers.
Passing an `aria-*`, `role` or `title` prop removes the `aria-hidden` attribute and makes the icon visible to screen readers. A `title` child on its own does not: without those props the icon stays hidden.
```tsx
<House>
<title>This is my house</title>
<House role="img" aria-labelledby="house-title">
<title id="house-title">This is my house</title>
</House>
// or