mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-12-03 16:59:42 +00:00
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:
@@ -22,13 +22,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
|
||||
|
||||
Reference in New Issue
Block a user