Allow other HTML elements besides <i>

Created on 10 May 2018, almost 7 years ago
Updated 23 July 2024, 9 months ago

By default, this module outputs FontAwesome icons using the <i> tag. The <i> tag was originally meant to mark up italicized text in HTML, though now it is more semantically correct to use the <em> tag for that purpose.

While there are some arguments to be made for the semantics of using the <i> tag for emphasis in HTML5, it seems that FontAwesome chose it for their icons because of it's shortness, and resemblance to "I"con. Quoting their docs: "we like the <i> tag for brevity, but using a <span> is more semantically correct" - https://fontawesome.com/how-to-use/svg-with-js#basic-use

In most cases, using the <i> tag would suffice, but websites that have to meet certain accessibility standards may have issues. Many accessibility tools will mark the usage of <i> tags as incorrect because it assumes you are using them for text emphasis, not for icons.

I propose that there should be an option to choose what HTML element is used to render FontAwesome icons. It could be a dropdown where you select from a few options (i, span, etc.), or it could be a textfield where the user can enter the HTML element of their choice. This option could be placed in the formatter settings on the Manage Display page, or there could be a global option that sets the HTML element site-wide.

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States amklose Wisconsin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024