mirror of
https://github.com/ForkAwesome/Fork-Awesome.git
synced 2025-01-12 16:20:30 +08:00
updating a11y how-tos and examples w/ aria-label method
This commit is contained in:
parent
f0c9879216
commit
703fda0939
@ -323,11 +323,11 @@
|
|||||||
|
|
||||||
<h4 class="margin-top-xl text-muted">If an icon represents an interactive element</h4>
|
<h4 class="margin-top-xl text-muted">If an icon represents an interactive element</h4>
|
||||||
<p>
|
<p>
|
||||||
In the case of focusable interactive elements, there are various options to include an alternative text or label to the element, without the need for any visually hidden <code><span></code> or similar. For instance, simply adding the <code>title</code> attribute to the interactive element itself will be sufficient to provide an accessible alternative name for the element, as well as providing the mouse tooltip.
|
In the case of focusable interactive elements, there are various options to include an alternative text or label to the element, without the need for any visually hidden <code><span></code> or similar. For instance, simply adding the <code>aria-label</code> attribute with a text description to the interactive element itself will be sufficient to provide an accessible alternative name for the element. If you need to provide a visual tooltip on mouseover/focus, we recommend additionally using the <code>title</code> attribute or a <a href="https://github.com/chinchang/hint.css">custom tooltip</a> solution.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="margin-bottom-lg margin-top-lg">
|
<div class="margin-bottom-lg margin-top-lg">
|
||||||
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">href=</span><span class="s">"path/to/shopping/cart"</span> <span class="na">title=</span><span class="s">"View 3 items in your shopping cart"</span><span class="nt">></span>
|
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">href=</span><span class="s">"path/to/shopping/cart"</span> <span class="na">aria-label=</span><span class="s">"View 3 items in your shopping cart"</span><span class="nt">></span>
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-shopping-cart"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-shopping-cart"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
@ -335,18 +335,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="margin-bottom-lg margin-top-lg">
|
<div class="margin-bottom-lg margin-top-lg">
|
||||||
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">href=</span><span class="s">"#navigation-main"</span> <span class="na">title=</span><span class="s">"Skip to main navigation"</span><span class="nt">></span>
|
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">href=</span><span class="s">"#navigation-main"</span> <span class="na">aria-label=</span><span class="s">"Skip to main navigation"</span><span class="nt">></span>
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-bars"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-bars"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
<small class="text-muted">an icon being used as a link to a navigation menu</small>
|
<small class="text-muted">an icon being used as a link to a navigation menu</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-danger"</span> <span class="na">href=</span><span class="s">"path/to/settings"</span> <span class="na">title=</span><span class="s">"Delete"</span><span class="nt">></span>
|
<div class="margin-bottom-lg margin-top-lg">
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-trash-o"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-danger"</span> <span class="na">href=</span><span class="s">"path/to/settings"</span> <span class="na">aria-label=</span><span class="s">"Delete"</span><span class="nt">></span>
|
||||||
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-trash-o"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span> <span class="na">title=</span><span class="s">"Delete this item?"</span><span class="nt">></i></span>
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
<small class="text-muted">an icon being used as a delete button's symbol</small>
|
<small class="text-muted">an icon being used as a delete button's symbol with a <code>title</code> attribute to provide a native mouse tooltip</small>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -715,19 +715,16 @@ fa-ban on fa-camera
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3 col-sm-4">
|
<div class="col-md-3 col-sm-4">
|
||||||
<p>
|
<p>
|
||||||
<a class="btn btn-default" href="path/to/settings">
|
<a class="btn btn-default" href="path/to/settings" aria-label="Settings">
|
||||||
<i class="fa fa-cog" title="Settings" aria-hidden="true"></i>
|
<i class="fa fa-cog" aria-hidden="true"></i>
|
||||||
<span class="sr-only">Settings</span>
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="btn btn-danger" href="path/to/settings">
|
<a class="btn btn-danger" href="path/to/settings" aria-label="Delete">
|
||||||
<i class="fa fa-trash-o" title="Delete" aria-hidden="true"></i>
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
<span class="sr-only">Delete</span>
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a class="btn btn-primary" href="#navigation-main">
|
<a class="btn btn-primary" href="#navigation-main" aria-label="Skip to main navigation">
|
||||||
<i class="fa fa-bars" aria-hidden="true" title="Skip to main navigation"></i>
|
<i class="fa fa-bars" aria-hidden="true"></i>
|
||||||
<span class="sr-only">Skip to main navigation</span>
|
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -751,9 +748,8 @@ fa-ban on fa-camera
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="path/to/shopping/cart" class="btn btn-primary">
|
<a href="path/to/shopping/cart" class="btn btn-primary" aria-label="View 3 items in your shopping cart">
|
||||||
<i class="fa fa-shopping-cart" title="View 3 items in your shopping cart" aria-hidden="true"></i>
|
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
|
||||||
<span class="sr-only">View 3 items in your shopping cart</span>
|
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -767,19 +763,16 @@ fa-ban on fa-camera
|
|||||||
With <a href="../accessibility/">our thoughts on icon accessibility</a> in mind, If an icon only adds some extra decoration or branding, it does not need to be announced to users as they are navigating your site or app aurally. Alternatively, if an icon conveys meaning in your content or interface, ensure that this meaning is also conveyed to assistive technologies through alternative displays or text.
|
With <a href="../accessibility/">our thoughts on icon accessibility</a> in mind, If an icon only adds some extra decoration or branding, it does not need to be announced to users as they are navigating your site or app aurally. Alternatively, if an icon conveys meaning in your content or interface, ensure that this meaning is also conveyed to assistive technologies through alternative displays or text.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-default"</span> <span class="na">href=</span><span class="s">"path/to/settings"</span><span class="nt">></span>
|
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-default"</span> <span class="na">href=</span><span class="s">"path/to/settings"</span> <span class="na">aria-label=</span><span class="s">"Settings"</span><span class="nt">></span>
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-cog"</span> <span class="na">title=</span><span class="s">"Settings"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-cog"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
||||||
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"sr-only"</span><span class="nt">></span>Settings<span class="nt"></span></span>
|
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
|
|
||||||
<span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-danger"</span> <span class="na">href=</span><span class="s">"path/to/settings"</span><span class="nt">></span>
|
<span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-danger"</span> <span class="na">href=</span><span class="s">"path/to/settings"</span> <span class="na">aria-label=</span><span class="s">"Delete"</span><span class="nt">></span>
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-trash-o"</span> <span class="na">title=</span><span class="s">"Delete"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-trash-o"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
||||||
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"sr-only"</span><span class="nt">></span>Delete<span class="nt"></span></span>
|
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
|
|
||||||
<span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span> <span class="na">href=</span><span class="s">"#navigation-main"</span><span class="nt">></span>
|
<span class="nt"><a</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span> <span class="na">href=</span><span class="s">"#navigation-main"</span> <span class="na">aria-label=</span><span class="s">"Skip to main navigation"</span><span class="nt">></span>
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-bars"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span> <span class="na">title=</span><span class="s">"Skip to main navigation"</span><span class="nt">></i></span>
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-bars"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
||||||
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"sr-only"</span><span class="nt">></span>Skip to main navigation<span class="nt"></span></span>
|
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
|
|
||||||
@ -800,9 +793,8 @@ fa-ban on fa-camera
|
|||||||
<span class="nt"></div></span>
|
<span class="nt"></div></span>
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
|
|
||||||
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">href=</span><span class="s">"path/to/shopping/cart"</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span><span class="nt">></span>
|
<div class="highlight"><pre><code class="html"><span class="nt"><a</span> <span class="na">href=</span><span class="s">"path/to/shopping/cart"</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span> <span class="na">aria-label=</span><span class="s">"View 3 items in your shopping cart"</span><span class="nt">></span>
|
||||||
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-shopping-cart"</span> <span class="na">title=</span><span class="s">"View 3 items in your shopping cart"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
<span class="nt"><i</span> <span class="na">class=</span><span class="s">"fa fa-shopping-cart"</span> <span class="na">aria-hidden=</span><span class="s">"true"</span><span class="nt">></i></span>
|
||||||
<span class="nt"><span</span> <span class="na">class=</span><span class="s">"sr-only"</span><span class="nt">></span>View 3 items in your shopping cart<span class="nt"></span></span>
|
|
||||||
<span class="nt"></a></span>
|
<span class="nt"></a></span>
|
||||||
</code></pre></div>
|
</code></pre></div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user