This issue has been created
There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-bf3f3722-93e6-4c36-a8b5-9c8d99a611f7 XWIKI-24715 Open

Font Awesome icons are broken when the icon class is set on .btn or a.button elements

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-6e3544db-edf4-42de-8779-934ccc70a192 Manuel Leduc created this issue on 19/Aug/26 16:37
 
Summary: Font Awesome icons are broken when the icon class is set on .btn or a.button elements
Issue Type: cid:jira-generated-image-avatar-bf3f3722-93e6-4c36-a8b5-9c8d99a611f7 Bug
Affects Versions: 18.0.0
Assignee: Unassigned
Components: Flamingo Skin
Created: 19/Aug/26 16:37
Labels: regression
Priority: cid:jira-generated-image-static-blocker-e9f6e461-1952-4f5e-9ddb-237cb8c96931 Blocker
Reporter: Manuel Leduc
Description:

Regression introduced XWIKI-15026.
Note this is not the same problem as XWIKI-24073 (accepted as wontfix)

Reproduction steps

On any 18.x page, in the browser console:

['span','a','button'].forEach(tag => ['fa fa-download', 'fa fa-download btn', 'fa fa-download button']
  .forEach(cls => {
    const e = document.createElement(tag);
    e.className = cls;
    document.body.appendChild(e);
    console.log(tag + ' | ' + cls + ' | font-weight=' + getComputedStyle(e, '::before').fontWeight);
    e.remove();
  }));

Or, with an extension installed that uses the Font Awesome 4 idiom of putting the icon class directly on the button (reproduced with the view-file macro of the xwiki-pro-macros-ui extension, version 1.32.0, which builds its modal download button as <a class="fa fa-download button button-primary">Home - XWiki.pdf</a>):

  • Attach a PDF to a page and insert {{view-file}} for it
  • Click the PDF preview thumbnail
  • Look at the download button in the top-left corner of the modal

Expected result

The icon renders (as it does on 17.10.x with Font Awesome 4.7.0), and the button's background wraps both the icon and its text label.

Actual result

  • The icon is a "missing glyph" box.
  • The label spills out of the button's background, because width: var(--fa-width, 1.25em) clamps the element to ~26px while the label needs ~113px.

Measured on the same page, same extension, two instances:

  XWiki 17.10.12 XWiki 18.4.4
Font Awesome 4.7.0 7.2.0
::before font-family FontAwesome (single face) Font Awesome 7 Free
::before font-weight 400 (irrelevant, one face only) 400 -> Regular -> no glyph
element width auto 25.8px (label needs 113px)
result icon + label inside the button tofu box, label outside the button

Setting font-weight: 900 and --fa-width: auto on the element restores the 17.10.12 rendering exactly.

Notes

xwiki-platform itself is not affected: it never puts the icon class on the button element, it always nests the icon in a child, e.g. <a class="btn btn-default"><span class="fa fa-download"></span> Label</a>. A grep over the
templates, skins and resources of the 18.4.4 distribution finds zero elements carrying both an fa fa- class and btn/button. So this only shows up in extensions written against Font Awesome 4, where putting fa fa- on the button itself was a valid and common idiom – it is a backward compatibility break for those extensions rather than a visible platform bug.

Affected combinations

Verified on 18.4.4 – computed ::before font-weight:

Markup font-weight icon renders
<span class="fa fa-download"> 900 yes
<span class="fa fa-download btn"> 400 no
<button class="fa fa-download btn"> 400 no
<a class="fa fa-download btn"> 400 no
<a class="fa fa-download btn btn-default"> 400 no
<a class="fa fa-download button"> 400 no
<span class="fa fa-download button"> 900 yes

 

 
 

4 updates

 
cid:jira-generated-image-avatar-6e3544db-edf4-42de-8779-934ccc70a192 Changes by Manuel Leduc on 19/Aug/26 16:37
 
Fix Version: 18.7.0
Version: 18.0.0
Version: 18.0.0-rc-1
Description: Regression introduced XWIKI-15026.
Note this is *not* the same problem as XWIKI-24073 (accepted as wontfix)
.
Also, it does not impact the product, only extensions such as the file picker from the pro macros.
h2. Reproduction steps

On any 18.x page, in the browser console:
{code:js}
['span','a','button'].forEach(tag => ['fa fa-download', 'fa fa-download btn', 'fa fa-download button']
  .forEach(cls => {
    const e = document.createElement(tag);
    e.className = cls;
    document.body.appendChild(e);
    console.log(tag + ' | ' + cls + ' | font-weight=' + getComputedStyle(e, '::before').fontWeight);
    e.remove();
  }));
{code}
Or, with an extension installed that uses the Font Awesome 4 idiom of putting the icon class directly on the button (reproduced with the {{view-file}} macro of the {{xwiki-pro-macros-ui}} extension, version 1.32.0, which builds its modal download button as {{{}<a class="fa fa-download button button-primary">Home - XWiki.pdf</a>{}}}):
* Attach a PDF to a page and insert {{{{{}view-file{}}}}} for it
* Click the PDF preview thumbnail
* Look at the download button in the top-left corner of the modal

h2. Expected result

The icon renders (as it does on 17.10.x with Font Awesome 4.7.0), and the button's background wraps both the icon and its text label.
h2. Actual result
* The icon is a "missing glyph" box.
* The label spills out of the button's background, because {{width: var(--fa-width, 1.25em)}} clamps the element to ~26px while the label needs ~113px.

Measured on the same page, same extension, two instances:
|| ||XWiki 17.10.12||XWiki 18.4.4||
|Font Awesome|4.7.0|7.2.0|
|{{::before}} font-family|{{FontAwesome}} (single face)|{{Font Awesome 7 Free}}|
|{{::before}} font-weight|400 (irrelevant, one face only)|400 -> Regular -> no glyph|
|element width|auto|25.8px (label needs 113px)|
|result|icon + label inside the button|tofu box, label outside the button|

Setting {{font-weight: 900}} and {{--fa-width: auto}} on the element restores the 17.10.12 rendering exactly.
h2. Notes

{{xwiki-platform}} itself is not affected: it never puts the icon class on the button element, it always nests the icon in a child, e.g. {{{}<a class="btn btn-default"><span class="fa fa-download"></span> Label</a>{}}}. A grep over the
templates, skins and resources of the 18.4.4 distribution finds *zero* elements carrying both an {{fa fa-
{ *} {* } }} * class and {{{}btn{}}}/{{{}button{}}}. So this only shows up in extensions written against Font Awesome 4, where putting {{fa fa- * }} * on the button itself was a valid and common idiom – it is a backward compatibility break for those extensions rather than a visible platform bug.
h2. Affected combinations

Verified on 18.4.4 – computed {{::before}} {{{}font-weight{}}}:
||Markup||font-weight||icon renders||
|{{<span class="fa fa-download">}}|900|yes|
|{{<span class="fa fa-download btn">}}|400|*no*|
|{{<button class="fa fa-download btn">}}|400|*no*|
|{{<a class="fa fa-download btn">}}|400|*no*|
|{{<a class="fa fa-download btn btn-default">}}|400|*no*|
|{{<a class="fa fa-download button">}}|400|*no*|
|{{<span class="fa fa-download button">}}|900|yes|