Details
-
Bug
-
Resolution: Unresolved
-
Blocker
-
18.0.0-rc-1
-
Unknown
-
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.
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 |
Attachments
Issue Links
- is caused by
-
XWIKI-15026 Upgrade Font Awesome to 7.x
-
- Closed
-
- is related to
-
XWIKI-24073 The 'More Actions' button is larger and the 'Quit tour' button icon is not centered anymore after upgrade to Font Awesome 7
-
- Closed
-