<?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>DEV Community: Tyler</title>
    <description>The latest articles on DEV Community by Tyler (@tylerjdev).</description>
    <link>https://dev.to/tylerjdev</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%2F174985%2Fe6832483-fd8f-4b02-a2cc-2bfee05d3d8f.png</url>
      <title>DEV Community: Tyler</title>
      <link>https://dev.to/tylerjdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tylerjdev"/>
    <language>en</language>
    <item>
      <title>Partial links are inaccessible</title>
      <dc:creator>Tyler</dc:creator>
      <pubDate>Sat, 03 Oct 2020 17:32:45 +0000</pubDate>
      <link>https://dev.to/tylerjdev/partial-links-are-inaccessible-40g4</link>
      <guid>https://dev.to/tylerjdev/partial-links-are-inaccessible-40g4</guid>
      <description>&lt;p&gt;Navigating through any website, you’re bound to find &lt;em&gt;partial links&lt;/em&gt;. I consider partial links to be links which do not contain enough text content to make them discernible from other links.&lt;/p&gt;

&lt;p&gt;A quick example of a partial link would be the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/abt"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;here&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, you wouldn’t be able to tell where the link would direct you to, as there’s no “proper” context describing it, nor is there enough text content. For some, there’s usually context before or after the link, so that they can make a informed decision of clicking that link or not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;See more on our about page &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;here&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;!&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- The link does not describe its purpose itself --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While that may be okay for some, a user who uses some form of assistive technology may not be able to get to that context preceding the link in the example.&lt;/p&gt;

&lt;p&gt;This is because some users may navigate a page through links. Maybe they’re trying to find a link that they’ve been to before, or some other scenario. When using a screen reader, you can navigate between landmarks, form elements, links, etc. When navigating through links, the example above would be listed as "here", without the context that precedes it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc6pgzmu4flcl0r1au78r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc6pgzmu4flcl0r1au78r.PNG" alt="NVDA Elements List, Links view"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example of the "Links" view in &lt;a href="https://www.nvaccess.org/" rel="noopener noreferrer"&gt;NVDA Screen Reader&lt;/a&gt; Elements List.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is also listed as "success criteria" for WCAG 2.1, that criteria being &lt;a href="https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only" rel="noopener noreferrer"&gt;Link Purpose 2.4.9 (Link Only)&lt;/a&gt; and/or &lt;a href="https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-in-context.html" rel="noopener noreferrer"&gt;Link Purpose 2.4.4 (In Context)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s also good to note that you do not have to be super specific when creating text content for a link. It’s better to give that link a short amount of context to describe it as well as text content, so that an AT user, (or any user) can perceive that link quicker.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to make it accessible
&lt;/h2&gt;

&lt;p&gt;Here’s a few things we can do to ensure that we’re making a link accessible by its text content.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ensure that the link text describes its purpose&lt;/strong&gt;
For example, if your link contains “here”, or “read”, or even “click me!”, then it doesn’t describe the purpose of the link; what exactly am I clicking? Ensure that the link describes where it will take the user, an example of short and efficient text content being: “&lt;strong&gt;About us&lt;/strong&gt;”, “&lt;strong&gt;More information on our product&lt;/strong&gt;”, “&lt;strong&gt;Our values&lt;/strong&gt;”.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ensure that the link has a proper accessible name&lt;/strong&gt;
Some links are inaccessible because they don’t contain any accessible text at all. An example being, if your link contains only an image without a descriptive alt text, or text alternative, then a user using assistive technology may not be able to figure out where that link will take them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make sure it isn't too verbose&lt;/strong&gt;
It's easy to give a link too much text content. Giving links short text content which describes the link fully enough so that any user can determine where it will take them is key.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In most cases, partial links are caused by only factoring the visual aspect of that link. For example, if you only give the text content "here", you’re assuming that the user is going through the navigational flow in order to receive the context for it. Though, this is disregarding the fact that users may navigate through links, missing out on that additional context.&lt;/p&gt;

&lt;p&gt;Giving links better text content helps us all, as some users may be able to better distinguish between that link and others visually, as well as via using AT.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;With that, I hope I helped you learn something new regarding web accessibility! Here’s a few links that I think may supplement this post.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://webaim.org/techniques/hypertext/" rel="noopener noreferrer"&gt;Links and Hypertext by WebAIM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-in-context.html" rel="noopener noreferrer"&gt;Understanding Success Criterion 2.4.4: Link Purpose (In Context)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG21/Understanding/link-purpose-link-only" rel="noopener noreferrer"&gt;Understanding Success Criterion 2.4.9 Link Purpose (Link Only)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.washington.edu/accessibility/links/" rel="noopener noreferrer"&gt;Using Meaningful Link Text by University of Washington&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>html</category>
      <category>a11y</category>
      <category>webdev</category>
    </item>
    <item>
      <title>When role="button" is not enough</title>
      <dc:creator>Tyler</dc:creator>
      <pubDate>Fri, 18 Sep 2020 00:41:30 +0000</pubDate>
      <link>https://dev.to/tylerjdev/when-role-button-is-not-enough-dac</link>
      <guid>https://dev.to/tylerjdev/when-role-button-is-not-enough-dac</guid>
      <description>&lt;p&gt;Whenever I find a website that I particularly like, I open up my browser’s devtools to get an idea on how it was built. Needless to say, I do this &lt;em&gt;quite a lot&lt;/em&gt;. In some cases, I solely look at the code to get an idea of how accessible a website truly is. One thing that always stands out like a sore thumb is an element with a improper role attribute.&lt;/p&gt;

&lt;p&gt;For this post I will talk about &lt;strong&gt;role="button"&lt;/strong&gt;, how it may be misused and how to make it accessible.&lt;/p&gt;

&lt;p&gt;Developers tend to use &lt;code&gt;role="button"&lt;/code&gt; to turn an element into a "button". This is to indicate to AT users, that the element with the attribute &lt;code&gt;role="button"&lt;/code&gt; is indeed a button. In many cases this is not enough to make that element accessible.&lt;/p&gt;

&lt;p&gt;Before I begin, I would like to say that in &lt;strong&gt;all cases&lt;/strong&gt;, utilizing a regular &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; element is preferred over &lt;code&gt;role="button"&lt;/code&gt;. You should only utilize the role in events where you cannot use a native button element.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is not enough?
&lt;/h2&gt;

&lt;p&gt;When utilizing &lt;code&gt;role="button"&lt;/code&gt;, you need to ensure that the element is tabbable, though that is only if the element isn’t already natively tabbable. For example, an anchor element &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; is natively tabbable if there is a valid &lt;code&gt;href&lt;/code&gt; attribute attached. &lt;/p&gt;

&lt;p&gt;Imagine the following scenario, where a user needs to utilize the search button, but it’s a div:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Toggles search input on/off --&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"openSesame"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Search&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- This is not at all accessible! --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In the example above, the element is not accessible.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Perhaps there’s some sort of constraint where you can’t turn an element into a native button. That’s where &lt;code&gt;role="button"&lt;/code&gt; comes in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- role attribute takes value as a string --&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"openSesame"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Search&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- is now a "button" in the accessibility tree --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Though we are close, this is still not accessible. An AT user cannot tab, nor focus onto the element, as there is no tabindex. We can fix that by adding a tabindex with the value of "0":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- tabindex="0" means element is in sequential focus navigation of the page --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"openSesame"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Search&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It might not be a surprise to hear me say that this still isn’t enough. In some cases, an AT user may now be able to focus and trigger this button, whereas some will still not be able to. &lt;/p&gt;

&lt;p&gt;Some screen readers simulate a "click" when enter is pressed instead of a keydown event. That means that in the above example, the "onclick" event would actually trigger for &lt;em&gt;some&lt;/em&gt; AT. Though for most, it still isn't accessible. This isn't a topic I will dwell on in this post, but this is always good to keep note of.&lt;/p&gt;

&lt;p&gt;In a good majority of cases where I see elements which have role="button", &lt;strong&gt;two out of three&lt;/strong&gt; criteria are met. One being &lt;code&gt;role="button"&lt;/code&gt; and second having a &lt;code&gt;tabindex&lt;/code&gt;, although they often fall short of having an actual keydown event attached. &lt;/p&gt;

&lt;p&gt;There are also cases where the element which has role="button" is a natively tabbable element, like an anchor element &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; (if a valid href is attached). In this case, using the "enter" key does work, yet you can’t activate an anchor element with the space key, whereas with a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; element, both "space" and "enter" would trigger it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to make it accessible
&lt;/h2&gt;

&lt;p&gt;Making an accessible button when a native button cannot be used is pretty simple. This is how:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add the role
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Add role="button" to the elem --&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello, I'm now a button!&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Adding role="button" will ensure that 'button' is announced to an AT user. Without that role, an AT user may be confused about what type of element it is. With the role added, it'll be listed as a "button" in the accessibility tree.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Add a tabindex
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hello, I’m a button!&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;A tabindex ensures that the element is tabbable so that a user may focus onto it. It's generally not advisable to set a tabindex value greater than 0. &lt;a href="https://webaim.org/techniques/keyboard/tabindex"&gt;Here's a good post on why you shouldn't set a positive tabindex.&lt;/a&gt; Do note that a negative tabindex such as -1 will remove that element from tab order, while allowing you to programmatically set focus to that element.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Add a keydown event
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div[role="button"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;keydown&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;keyD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keyCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// e.key &amp;amp;&amp;amp; e.keycode have mixed support - keycode is deprecated but support is greater than e.key&lt;/span&gt;
  &lt;span class="c1"&gt;// I tested within IE11, Firefox, Chrome, Edge (latest) &amp;amp; all had good support for e.key&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;keyD&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Enter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;keyD&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Spacebar&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;keyD&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;keyD&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// In IE11 and lower, e.key will equal "Spacebar" instead of ' '&lt;/span&gt;

    &lt;span class="c1"&gt;// Default behavior is prevented to prevent the page to scroll when "space" is pressed&lt;/span&gt;
    &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Adding a proper keydown event should ensure that the element triggers the click event (if one is attached). There are many ways to implement a keydown event, however I'd use whatever is suitable for your situation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Test it
&lt;/h3&gt;

&lt;p&gt;You should always manually test something, especially for a11y purposes. Perhaps something is blocking the keydown event, or maybe focus isn’t styled properly on the element. You won’t know until you test it out! For this, you can utilize your keyboard to try to "trigger" the element. &lt;/p&gt;

&lt;p&gt;I'd also suggest trying out a screen reader. I'd highly recommend NVDA, which is a &lt;a href="https://www.nvaccess.org/"&gt;free open source screen reader&lt;/a&gt;. You may already have a screen reader pre-installed too! &lt;/p&gt;

&lt;p&gt;If you're a macOS user, you should have access to VoiceOver, which is a very easy to use screen reader. &lt;a href="https://www.apple.com/voiceover/info/guide/_1121.html"&gt;VoiceOver comes pre-installed with most Mac systems.&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you're a windows user you should have Narrator installed, &lt;a href="https://support.microsoft.com/en-us/help/22798/windows-10-complete-guide-to-narrator"&gt;which is a screen reader made by Microsoft&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common gotchas
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Anchor elements and role="button"&lt;/strong&gt;
It’s easy to add a role to an element without realizing that more needs to be added to make it fully functional. I often see anchor elements &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; with &lt;code&gt;role="button"&lt;/code&gt; attached. This is perfectly fine, but I often see a step missing with ensuring true accessibility of that element.
An anchor element only triggers with the &lt;strong&gt;"enter"&lt;/strong&gt; key, whereas a native button element will trigger by both &lt;strong&gt;"enter"&lt;/strong&gt; and &lt;strong&gt;"space"&lt;/strong&gt;.
To ensure an anchor element with a role of button is accessible, add a separate keydown for the &lt;strong&gt;"space"&lt;/strong&gt; key. This keydown event should trigger the same event that a click, or pressing the &lt;strong&gt;“enter”&lt;/strong&gt; key would.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styles and role="button"&lt;/strong&gt;
When utilizing &lt;code&gt;role="button"&lt;/code&gt;, sometimes it’s good to style that element as an actual button would appear. This isn’t exactly a requirement, but it'll ensure that users are able to recognize it as a button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not having the same click and keydown event&lt;/strong&gt;
A keydown event should trigger the same event as the click event. You should also ensure that a click event is attached and that the element utilizing &lt;code&gt;role="button"&lt;/code&gt; should function the same way for click, "enter" or "space".&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  ARIA attributes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;There are a few ARIA attributes you can utilize to make role="button" even more accessible.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;aria-pressed&lt;/code&gt;
Attribute &lt;code&gt;aria-pressed&lt;/code&gt; can have the values "&lt;strong&gt;true&lt;/strong&gt;", "&lt;strong&gt;false&lt;/strong&gt;" or "&lt;strong&gt;mixed&lt;/strong&gt;". Utilizing this attribute means that you can make a "toggle" button, which indicates the state of the button. When the value is "true", it means that the button is currently pressed and when the value is "false", it means that the button is not currently pressed. The "mixed" value means that the values of more than one item controlled by the button do not all share the same value. &lt;em&gt;I personally haven't seen aria-pressed="mixed" being used before, and I have not used it myself.&lt;/em&gt; 
&lt;a href="https://www.w3.org/TR/wai-aria-1.1/#aria-pressed"&gt;Here's a bit more information about aria-pressed from the specification&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aria-expanded&lt;/code&gt;
You may utilize aria-expanded to notify the user that the element, or element it controls is either expanded or collapsed. &lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/accordion/accordion.html"&gt;This is generally used when making accordions&lt;/a&gt;, where the content is initially hidden and only expanded when activating the trigger. The values supported by &lt;code&gt;aria-expanded&lt;/code&gt; are "&lt;strong&gt;true&lt;/strong&gt;" or "&lt;strong&gt;false&lt;/strong&gt;".
&lt;a href="https://www.w3.org/TR/wai-aria-1.1/#aria-expanded"&gt;You can learn more from the specification&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;p&gt;With that, I hope this article helps you when creating accessible buttons! There's a lot of different ways to utilize WAI-ARIA, some of which I hope to cover soon. Please feel free to ask questions!&lt;/p&gt;

&lt;p&gt;Here's a few posts that I believe will supplement what was discussed in this post.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role"&gt;ARIA: button role - Accessibility | MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://inclusive-components.design/toggle-button/"&gt;Toggle Buttons - Inclusive Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/examples/button/button.html"&gt;Button Examples | WAI-ARIA Authoring Practices 1.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.last-child.com/keyboard-accessibility-with-the-space-bar/"&gt;Keyboard Accessibility with the Space Bar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://allyjs.io/what-is-focusable.html"&gt;What does "focusable" mean? - ally.js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/TR/using-aria/"&gt;Using ARIA&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>a11y</category>
      <category>aria</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
