Skip to content

Commit 5662b9e

Browse files
aria-hidden
1 parent 2f838c2 commit 5662b9e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ echo $FA->get_svg('fas fa-file', [
128128

129129
### `aria-hidden` attribute
130130

131-
`aria-hidden="true"` is added to the SVG tag by default unless `<title id="">` or `aria-label` is set.
131+
`aria-hidden="true"` is added to the SVG tag by default unless `<title id="">` (and `aria-labelledby`) or `aria-label` is set.
132132

133133
```php
134134
echo $FA->get_svg('fas fa-file');

src/FontAwesomeSVG.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ public function get_svg($id, $opts=[]) {
8080
$item->setAttribute('aria-labelledby', $title_id);
8181
}
8282

83-
} elseif(isset($aria_opts['aria-hidden'])) {
83+
}
84+
85+
86+
if(!isset($aria_opts['aria-label']) && !isset($opts['title_id'])) {
8487
$item->setAttribute('aria-hidden', 'true');
8588
}
8689
}

0 commit comments

Comments
 (0)