We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4082041 commit a2aed0fCopy full SHA for a2aed0f
src/FontAwesomeSVG.php
@@ -60,11 +60,15 @@ public function get_svg($id, $opts=false) {
60
$title = $doc->createElement("title");
61
$title->nodeValue = $opts['title'];
62
63
- // TODO: add aria-labelledby
64
- //$title->setAttribute('id', '');
65
- //$item->setAttribute('aria-labelledby', '');
66
-
67
- $item->appendChild($title);
+ $title_node = $item->appendChild($title);
+
+ // <title> id attribute has to be set to add aria-labelledby
+ if(isset($opts['title_id'])) {
+ $title_id = $opts['title_id'];
68
+ $title_node->setAttribute('id', $title_id);
69
+ $item->setAttribute('aria-labelledby', $title_id);
70
+ }
71
72
} else {
73
$item->setAttribute('aria-hidden', 'true');
74
}
0 commit comments