Effect of aria-hidden in Font Awesome - html

what's the effect of aria-hidden in Font Awesome?
Is it necessary to use it? why? or why not?
for example, I want to know the effect of aria-hidden="true" in the code below:
<i class="fa fa-star" aria-hidden="true"></i>

In short, it makes the icon not visible to screen readers, to enhance accessibility.
From the documentation:
If you're using an icon to add some extra decoration or branding, it does not need to be announced to users as they are navigating your site or app aurally. Additionally, if you're using an icon to visually re-emphasize or add styling to content already present in your HTML, it does not need to be repeated to an assistive technology-using user. You can make sure this is not read by adding the aria-hidden="true" to your Font Awesome markup.

If you're using an icon to add some extra decoration or branding, it
does not need to be announced to users as they are navigating your
site or app aurally. Additionally, if you're using an icon to visually
re-emphasize or add styling to content already present in your HTML,
it does not need to be repeated to an assistive technology-using user.
You can make sure this is not read by adding the aria-hidden="true" to
your Font Awesome markup.
<i class="fa fa-fighter-jet" aria-hidden="true"></i>
an icon being used as pure decoration
<h1 class="logo">
<i class="fa fa-pied-piper" aria-hidden="true"></i>
Pied Piper, A Middle-Out Compression Solution Making Data Storage Problems Smaller
</h1>
an icon being used as a logo
Source: http://fontawesome.io/accessibility/

Related

Font Awesome Icons Weirdly Not Displaying In Shopify Store

After spending hours going around in circles. I've reached a level of frustration where I need an outside perspective.
See this code here and how it produces exactly what should be expected.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<p class="fa fa-check-circle fa_custom"> Verified</p>
<i class="fa fa-check"></i>
Then if I enter this code within a Shopify liquid file.
The output is this:
Why isn't one of the icons showing?
I've made this demonstration to highlight my problem. I'm experiencing this with a few other font awesome icons as well. I'm designing pages in HTML / CSS in sublime. Then when I take this code into a Shopify store. The icons can't be seen. I've replicated this problem in multiple stores.
It's very strange. Can someone please help me.
You have the first icon inside a p-statement.
Maybe one of your CSS-files is changing the font.
Tried this one?
<i class="fa fa-check-circle fa_custom"></i> Verified <i class="fa fa-check"></i>

How To Make Font Awesome Elements Have Discernable Names?

Bonjour,
Trying to solve the audit point of discernable names of font awesome icons/elements using Lighthouse I dont't know how answer to this challenge : How To Make Font Awesome Elements Have Discernable Names ?
The actual result in Lighthouse ask for "Elements Have Discernable Names"
here is the basic code
<i class="fa fa-twitter black"></i>
Best regards
J.
Add the aria-label property to pass the audit.
<i class="fa fa-twitter black"></i>
More information about aria-label can be found at https://dev.opera.com/articles/ux-accessibility-aria-label/#accessible-name-calculation

Have Two Font Awesome Icons in One i Tag

I've been scouring the web, and I can't find an answer to this. Is there away to add two Font Awesome icons in one i tag?
I can do it if I put two i tags side by side, like this:
Good for: <i class="fa fa-male fa-2x"></i><i class=" fa fa-female fa-2x"></i>
So is there anyway to do this?
Glyph-based fonts like this generally function by changing the content of the element to a specific value, which the font picks up and renders as the appropriate glyph.
So it's unlikely that you'll be able to use a single tag to display both of them unless the library provides specific syntax for handling that behavior on it's own (similar to how Font Awesome uses stacking).
This is not possible in a single <i> tag, reason is the way how the glyph identifying classes are applied. For longer or dynamic sequences you can however directly use the icons codes in markup notation:
html: <span class="font-awesome">&#xf183&#xf182</span>
css: .font-awesome { font-family: FontAwesome; }
This obviously requires that you load the font as FontAwesome.
I created a fiddler as simple demonstration: https://jsfiddle.net/6ofmn36g/
I do agree though that this is an approach that is somewhat hard to read, though...
With Font Awesome 5, it's possible!
Masking
Combine two icons create one single-color shape, thanks to the power of SVG in Font Awesome 5! Use it with our new Power Transforms for some really awesome effects.
Go through the Masking section in this link.
The below snippet is a small working example taken from their site
<!-- Important : Use the SVG & JS method and reference the Js file, not the CSS file -->
<script src="https://use.fontawesome.com/releases/v5.0.13/js/all.js"></script>
<div class="fa-4x">
<i class="fas fa-pencil-alt" data-fa-transform="shrink-10 up-.5" data-fa-mask="fas fa-comment" style="background:MistyRose"></i>
<i class="fab fa-facebook-f" data-fa-transform="shrink-3.5 down-1.6 right-1.25" data-fa-mask="fas fa-circle" style="background:MistyRose"></i>
<i class="fas fa-headphones" data-fa-transform="shrink-6" data-fa-mask="fas fa-square" style="background:MistyRose"></i>
</div>
Not possible with current library of FontAwesome. But there are work arounds as arkascha has suggested below.
Additional Info:
Not exactly what you are asking for But I think this will help you, Also future crowd who falls into this thread with the title.
I had answered similar stuff... Here
https://stackoverflow.com/a/36491858/2592042
You can also build a custom icon by using set of icons available in the font-awesome icon set by stacking and aligning them accordingly. Stacked Icons
Example:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<span class="fa-stack fa-lg">
<i class="fa fa-male fa-stack-1x"></i>
<i class="fa fa-female fa-stack"></i>
</span>

Accessibility for button with font icon in it

I'm having an accessibility problem with the button element. I'm wondering if this is the good way to do it. I have a button and the only content is a Font-Awesome (font-icon) in it. I was wondering if adding a title attribute to my button was enough to make it accessible ?
Like this:
<button class="prev" title="My accessible title">
<i class="fa fa-chevron-circle-left"></i>
</button>
The correct property in this case should be aria-label or aria-labeledby:
<button class="prev" aria-label="My accessible title">
<i class="fa fa-chevron-circle-left"></i>
</button>
With this, the screen reader for example will reproduce My accessible title instead the icon inside it.
See more:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-labelledby_attribute
You have to use both titleand aria-label attributes as some screenreaders does not read the title attribute, while other users won't benefit of the aria-label attribute.
You have to remember that accessibility does not only target screenreaders users but also every other people, so aria-label won't be sufficient.
Also note that, for better accessibility, you might want to add a way to show the description when you focus the button with the keyboard. That would be a good idea.
That being said, I will be silly enough to suggest that some part of the description of your button might be always visible for better accessibility.
For instance, the following examples shows how the two attributes might be used conjointly with a short visible hint for a popup close button :
<button aria-label="Back to the page" title="Close popup">
<i class="fa fa-times"></i>
Close
</button>
The title attribute is the most widely supported attribute for assistive technologies. This includes Dragon (which heavily relies on the title attribute for targeting elements) as well as all modern screen readers that implement the ARIA accessible name computation algorithm and many older screen readers.
As can be seen in step D of that algorithm, the final element that is evaluated is the title attribute.

Font Awesome showing and not showing (concrete5)

My website runs on Concrete5.
I wanted to add some more Font Awesome icon to an existing page, but it's not showing. Strange thing is, there already are icons on my webpage and they are showing...
However when I edit the block with the icons in it to check the HTML, there is no HTML/CSS saying the icons should be there!
When I add an icon in the content block in HTML, nothing shows. But when I add an icon with an HTML block it does show.
For instance the tree columns underneath the green picture show three green check boxes.
And this is what the content block says is in the block:
<p>Sessie 1</p>
<p>Analyse van je proces van vliegangst en je omslagpunt</p>
<p>Stoppen van de angst, piekeren en vervelende herinneringen</p>
<p>Praktische oefeningen voor thuis</p>
See the website here
As you can see, there is no font-awesome css in there. But icons are showing on the webpage. The css is also showing when you check the html of the page.
Now, if I would put
<p> <i class="fa fa-camera-retro"></i> test</p>
In the same block (a content block, in the html window). It won't show a camera. It would just show "test".
If I then go back to the content block and see what's in the html, it says
<p>test</p>
Now if I would put the same line of code in an HTML block, it does show the camera icon.
So there are two things happening:
Older font-awesome icons are showing on the webpage but not in the content blocks html.
New font-awesome icons can't be added through html in content blocks, but can in HTML blocks.
Edit: When I use this code:
<p class="fa fa-camera-retro"></p>
It does show in the content block. But then I can't simply add a symbol with some text, because the font will be from the font-awesome font.
the <i> tag still isn't working.
so
<i class="fa fa-camera-retro"></i>
Gives nothing.
The icons only appear when there's text between the code:
<i class="fa fa-camera-retro">foo</i>
However, the editor changes the <i> tag then to an <em> tag. And 'foo' then has the font-awesome font. Not the font of my website.
****SOLUTION****
If I do it like this:
<p><i class="fa fa-camera-retro"> </i> some text</p>
Everything works as I want.
Still, all the older font-awesome css from the website is missing from the content blocks, but it is rendering when I view the website in a browser. If anyone has a suggestion how that can be fixed?
Ahh, I think I see your problem. You entered a new HTMLblock, and just pasted in the fa-camera-retro. FontAwesome works as a class and should be entered within a tag.
You can use the <i> tag for it, but also the <p> tag or whatever you want. It should be then something like
<i class="fa fa-camera-retro"></i> (dont forget the extra fa class to make it appear as a font awesome.
It's also worth remembering for the future that when you use the content block, TINYMCE automatically strips out some HTML tags by default, this includes <i>'s... To prevent TINYMCE from doing this, go to:
Dashboard > System & Settings > BASICS / Rich Text Editor. Once there, select 'Custom' and add the following line
verify_html: false
For more information, it's worth keeping this in your bookmarks when using Concret5, especially the content block: http://www.tinymce.com/wiki.php/Configuration3x:verify_html
I saw this on your page:
It should be <p><i class="fa fa-camera-retro"></i> some text</p>
Result:
So basically what you need to so is just change this
<p>fa-camera-retro</p>
to this
<p><i class="fa fa-camera-retro"></i> some text</p>
The trick to adding FontAwesome icons in C5 Content blocks is using the em tag along with adding code for non-breaking space between them.
<em class="fa fa-camera-retro"> </em>
Check if you have given your icon any sort of margin, I had the same problem where some icons would make when I checked keenly I noticed I had a CSS rule.
p i{
margin-left:10px;
}
when I removed that margin all my icons worked.