<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Laken Hafner</title>
    <description>The latest articles on Forem by Laken Hafner (@laken).</description>
    <link>https://forem.com/laken</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F91106%2F4d89d3b2-539a-4a9d-8a4d-0f7f825699c1.jpeg</url>
      <title>Forem: Laken Hafner</title>
      <link>https://forem.com/laken</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/laken"/>
    <language>en</language>
    <item>
      <title>Most Common (well-meaning) A11y Mistakes</title>
      <dc:creator>Laken Hafner</dc:creator>
      <pubDate>Sun, 29 Apr 2018 14:06:32 +0000</pubDate>
      <link>https://forem.com/laken/most-common-well-meaning-a11y-mistakes-2bap</link>
      <guid>https://forem.com/laken/most-common-well-meaning-a11y-mistakes-2bap</guid>
      <description>&lt;p&gt;Whenever I look over a website for Web Accessibility (a11y) issues, there are a few a11y mistakes that I see repeated many times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not every image needs alternative text
&lt;/h2&gt;

&lt;p&gt;Incorrect alternative text is one a11y mistake I see everywhere, even on the websites of large corporations. Alternative text is only needed if the image conveys additional information that the text does not.&lt;/p&gt;

&lt;p&gt;If an image doesn’t need alternative text, you still must not omit the &lt;code&gt;alt&lt;/code&gt; attribute! Instead, leave the &lt;code&gt;alt&lt;/code&gt; attribute empty, like so:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img src="foo.png" alt="" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An empty &lt;code&gt;alt&lt;/code&gt; attribute tells screen-readers that the image is not needed to understand the content. No &lt;code&gt;alt&lt;/code&gt; attribute causes some screen-readers to try and explain the image, such as reading the image’s URL. As you can imagine, this is a horrible user-experience; it’s even worse when the image does absolutely nothing to help understand the content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every form field needs a label
&lt;/h2&gt;

&lt;p&gt;Omitting form field labels in exchange for just using placeholders is considered a &lt;em&gt;trendy&lt;/em&gt; thing to do right now in the world of Web Design. It’s troubling that the trend caught on, as it’s horrible for a11y.&lt;/p&gt;

&lt;p&gt;On some screen-readers, the placeholder is ignored entirely. Therefore, you should always use a label associated with each form field.&lt;/p&gt;

&lt;p&gt;If you are dead set on using placeholders, at least include a label anyway, but with a class that allows screen-readers to see it. For example:&lt;/p&gt;

&lt;p&gt;HTML:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;label for="email_address" class="sr-only"&amp;gt;Email&amp;lt;/label&amp;gt;
&amp;lt;input id="email_address" type="text" placeholder="Email" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CSS:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.sr-only {
 position: absolute;
 width: 1px;
 height: 1px;
 margin: -1px;
 padding: 0;
 border: 0;
 clip: rect(0 0 0 0);
 overflow: hidden;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you do go this route, make sure that the label text is the same as the placeholder text. The label text is what dictation-based assistive technologies use for navigating form fields on your website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Too much ARIA
&lt;/h2&gt;

&lt;p&gt;In HTML5, you can use &lt;code&gt;aria&lt;/code&gt; attributes that allow assistive technologies to understand parts of your website better.&lt;/p&gt;

&lt;p&gt;However, if aria is misused, it’s worse than if you didn’t have any &lt;code&gt;aria&lt;/code&gt; attributes on your site at all.&lt;/p&gt;

&lt;p&gt;The most common misused &lt;code&gt;aria&lt;/code&gt; attribute that I see is the &lt;code&gt;role&lt;/code&gt; one. I believe the reason this one is so widely misused is due to the programming method &lt;em&gt;“Stack Overflow Copy/Pasting”&lt;/em&gt;. For example, if you style an &lt;code&gt;a&lt;/code&gt; element to look like a button for your CTA (Call to Action), the example you see might have &lt;code&gt;role="button"&lt;/code&gt;. The &lt;code&gt;role&lt;/code&gt; attribute doesn’t tell assistive technologies what the element looks like, but how it behaves. Link elements don’t have the same keyboard controls that &lt;code&gt;button&lt;/code&gt; elements do. For example, buttons can be toggled with the space bar, but that doesn’t do anything on a link, other than making your page scroll down on many browsers.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://laken.net/blog/most-common-a11y-mistakes/"&gt;Most Common (well-meaning) A11y Mistakes&lt;/a&gt; appeared first on &lt;a href="https://laken.net"&gt;Laken Hafner&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
