Skip to content

Commit

Permalink
Update icons.md
Browse files Browse the repository at this point in the history
Improve accessibility
  • Loading branch information
chmst authored Nov 2, 2024
1 parent 260f79b commit 59c62a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions versioned_docs/version-5.2/general-concepts/icons.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ To display such an icon you can use:

```php
?>
<span class="icon-cancel"></span> <?php echo Text::_('JCANCEL') ?>
<span class="icon-cancel" aria-hidden="true"></span> <?php echo Text::_('JCANCEL') ?>
```
The attribute aria-hidden="true" hides the icon from screen readers and improves accessibility.

You can also display FontAwesome icons which aren't used in Joomla, but you have to include an additional CSS class.
According to [fa style names](https://docs.fontawesome.com/web/setup/upgrade/whats-changed#full-style-names) the CSS classes should be "fa-solid" or "fa-brands":

```php
?>
<span class="fa-solid fa-bomb"></span> <?php echo Text::_('JSAVE') ?>
<span class="fa-brands fa-facebook"></span> <?php echo 'facebook' ?>
<span class="fa-solid fa-bomb" aria-hidden="true"></span> <?php echo Text::_('JSAVE') ?>
<span class="fa-brands fa-facebook" aria-hidden="true"></span> <?php echo 'facebook' ?>
```

0 comments on commit 59c62a5

Please sign in to comment.