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:
@@ -23,12 +23,16 @@ 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 binding the `title` input of the icon component.
|
||||
To expose an icon to assistive technologies, provide an accessible name by binding the `title` input of the icon component, or by setting an `aria-label` attribute on it.
|
||||
|
||||
This removes the `aria-hidden` attribute and makes the icon visible to screen readers.
|
||||
Setting the `title` input, or any `aria-*` or `role` attribute, stops the icon from being hidden from screen readers.
|
||||
|
||||
```angular-html
|
||||
<svg lucideHouse title="This is my house" />
|
||||
|
||||
<!-- or -->
|
||||
|
||||
<svg lucideHouse aria-label="This is my house" />
|
||||
```
|
||||
|
||||
Choose a label that clearly describes the meaning of the icon or the action it represents in the context of your application.
|
||||
|
||||
Reference in New Issue
Block a user