?
avatar chmst
chmst
28 Jun 2021

Steps to reproduce the issue

A user wants to build a menu with icons instead of texts.

He enters "icon-eye" as link class (or another class see issue #30793)
and sets displlay menuTitle off

grafik

Expected result

Same behaviour as with images:
If display menuTitle is off, show only the icon with visually hidden Menu Title as Text

Actual result

The icon is displayed (no aria-hidden = true), the menu Item title also is displayed (but with wrong font) also if "display menu title" is off

grafik

avatar chmst chmst - open - 28 Jun 2021
avatar joomla-cms-bot joomla-cms-bot - change - 28 Jun 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Jun 2021
avatar chmst chmst - change - 28 Jun 2021
The description was changed
avatar chmst chmst - edited - 28 Jun 2021
avatar chmst chmst - change - 28 Jun 2021
The description was changed
avatar chmst chmst - edited - 28 Jun 2021
avatar chmst chmst - change - 28 Jun 2021
Title
[4.0] Not possible to use a icon as menu item
[4.0] Not possible to use an icon as menu item
avatar chmst chmst - edited - 28 Jun 2021
avatar brianteeman
brianteeman - comment - 28 Jun 2021

Has this ever been possible? I know in Joomla 3 I used an image to achieve this

avatar brianteeman
brianteeman - comment - 28 Jun 2021

The issue of the wrong font when the icon class is used has been raised before. I believe it is caused because fontawesome is classed as a serif font

avatar chmst
chmst - comment - 28 Jun 2021

Same in J3 - probably never tried this before without override.

avatar chmst
chmst - comment - 28 Jun 2021

If it were possible to use an icon in the same way as an image it can be made a11y and displayed independent of the menu item title.

avatar brianteeman
brianteeman - comment - 28 Jun 2021

At this time that would need quite a bit of markup change in the menu module. Because of the way the icon changes the font it needs be a separate class and not a class on the link itself. Which also means it would have to be a separate field so that you could still add a link class

avatar drmenzelit
drmenzelit - comment - 29 Jun 2021
avatar brianteeman
brianteeman - comment - 29 Jun 2021

The problem is that the link class adds a class to the entire link when all you want is to add a new span just for the icon. This could be achieved with an override. To change it for core it would require a lot more as you would need to keep the link class and then add another field for an icon class and its associated markup.

Another option without changing markup is you could change the css as below. Replacing Roboto with your own site font

.fa, .fas, [class*=" icon-"], [class^=icon-] {
    font-family: Font Awesome\ 5 Free, Roboto;
    font-weight: 900;
}
avatar chmst chmst - close - 6 Jul 2021
avatar chmst
chmst - comment - 6 Jul 2021

Please test #34658

avatar chmst chmst - change - 6 Jul 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-07-06 17:44:16
Closed_By chmst

Add a Comment

Login with GitHub to post a comment