<?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: Ben Myers</title>
    <description>The latest articles on DEV Community by Ben Myers (@bendmyers).</description>
    <link>https://dev.to/bendmyers</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%2F225459%2F5813c2d3-d70c-421e-8a44-ada26c60642e.jpeg</url>
      <title>DEV Community: Ben Myers</title>
      <link>https://dev.to/bendmyers</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bendmyers"/>
    <language>en</language>
    <item>
      <title>What is your most complex focus interaction?</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Wed, 19 Aug 2020 01:11:21 +0000</pubDate>
      <link>https://dev.to/bendmyers/let-s-chat-complex-focus-interactions-5cn</link>
      <guid>https://dev.to/bendmyers/let-s-chat-complex-focus-interactions-5cn</guid>
      <description>&lt;p&gt;Web accessibility folks, especially those working in web apps... what is the most complex focus interaction on your site? What makes it complex, and how do you address it?&lt;/p&gt;

&lt;p&gt;I'm especially interested in cases where you have to programmatically move the user's focus. Additionally, I'd love to know your stack, and whether you feel that stack helps or hinder your focus management.&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>discuss</category>
    </item>
    <item>
      <title>TIL About .bold(), .blink(), and More JavaScript String Methods</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Fri, 21 Feb 2020 02:48:13 +0000</pubDate>
      <link>https://dev.to/bendmyers/til-about-bold-blink-and-more-javascript-string-methods-5hhe</link>
      <guid>https://dev.to/bendmyers/til-about-bold-blink-and-more-javascript-string-methods-5hhe</guid>
      <description>&lt;p&gt;While playing around in the Chrome DevTools, I noticed a string method I had never seen before: &lt;code&gt;.bold()&lt;/code&gt;. Curiosity got the better of me, and I gave it a try.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;myString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;myString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// returns "&amp;lt;b&amp;gt;Hello World!&amp;lt;/b&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's a method that returns the string wrapped in a &lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt; tag. It's &lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/bold"&gt;very deprecated&lt;/a&gt;&lt;/strong&gt;, but &lt;a href="https://caniuse.com/#feat=mdn-javascript_builtins_string_bold"&gt;all major browsers still support it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.bold()&lt;/code&gt; is not alone - I've found several other string methods that are in the same boat. &lt;strong&gt;Again, these are all deprecated, and should not be used in the wild.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/anchor"&gt;&lt;code&gt;.anchor(name)&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags with the &lt;code&gt;name&lt;/code&gt; attribute set to the given name&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/big"&gt;&lt;code&gt;.big()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/big"&gt;&lt;code&gt;&amp;lt;big&amp;gt;&lt;/code&gt;&lt;/a&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fixed"&gt;&lt;code&gt;.fixed()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tt"&gt;&lt;code&gt;&amp;lt;tt&amp;gt;&lt;/code&gt;&lt;/a&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fontcolor"&gt;&lt;code&gt;.fontcolor(color)&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/font"&gt;&lt;code&gt;&amp;lt;font&amp;gt;&lt;/code&gt;&lt;/a&gt; tags with the &lt;code&gt;color&lt;/code&gt; attribute set to the given color&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fontsize"&gt;&lt;code&gt;.fontsize(size)&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/font"&gt;&lt;code&gt;&amp;lt;font&amp;gt;&lt;/code&gt;&lt;/a&gt; tags with the &lt;code&gt;size&lt;/code&gt; attribute set to the given size&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/italics"&gt;&lt;code&gt;.italics()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/link"&gt;&lt;code&gt;.link(url)&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags with the &lt;code&gt;href&lt;/code&gt; attribute set to the given URL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/small"&gt;&lt;code&gt;.small()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/small"&gt;&lt;code&gt;&amp;lt;small&amp;gt;&lt;/code&gt;&lt;/a&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/strike"&gt;&lt;code&gt;.strike()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;code&gt;&amp;lt;strike&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/sub"&gt;&lt;code&gt;.sub()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;code&gt;&amp;lt;sub&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/sup"&gt;&lt;code&gt;.sup()&lt;/code&gt;&lt;/a&gt;:&lt;/strong&gt; Returns the string wrapped in &lt;code&gt;&amp;lt;sup&amp;gt;&lt;/code&gt; tags.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;... and, of course, my personal favorite: &lt;strong&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/blink"&gt;&lt;code&gt;.blink()&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, which returns your string wrapped in a &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As with &lt;code&gt;.bold()&lt;/code&gt;, these methods are all officially deprecated. Several of them even wrap your strings in &lt;em&gt;tags&lt;/em&gt; that have long since been deprecated. These methods remain in browsers for the sake of backwards compatibility, an artifact of development past.&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>CSS Influences Screenreaders</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Fri, 14 Feb 2020 02:23:19 +0000</pubDate>
      <link>https://dev.to/bendmyers/css-influences-screenreaders-2b25</link>
      <guid>https://dev.to/bendmyers/css-influences-screenreaders-2b25</guid>
      <description>&lt;p&gt;&lt;em&gt;This was originally posted &lt;a href="https://blog.benmyers.dev/css-can-influence-screenreaders/"&gt;on my blog&lt;/a&gt;, where I've included inline examples.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Let's say we're building a shopping list app. As we build out the app, we decide to style the list, stripping out the bullets that the browser gives us by default.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/MWwKvzX?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Being dutiful accessibility testers, let's run our screenreaders over the two lists. Pause for a moment and ask yourself: &lt;strong&gt;do you expect any difference between how the two lists are announced? Why or why not?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I was able to test the two lists with &lt;a href="https://www.nvaccess.org/download/"&gt;NVDA&lt;/a&gt; for Windows and &lt;a href="https://www.apple.com/accessibility/mac/vision/"&gt;VoiceOver&lt;/a&gt; for macOS. I ran NVDA against the lists on Chrome, Firefox, and even Internet Explorer. I ran VoiceOver against Chrome and Safari. Here's what I found:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When I tested against the first, bulleted list, the screenreaders always told me how many items were in the list and preluded each list item with "bullet."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When I tested against the second, bulletless list, the screenreaders never said "bullet."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most surprisingly, Safari with VoiceOver didn't treat the bulletless list as a list at all, omitting any announcements about how many items were in the list.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;... Huh.&lt;/p&gt;

&lt;p&gt;As we keep building our hypothetical shopping list app, we implement a feature to let users add new items, complete with a shiny new "Add" button. We'll even set it to be all uppercase with CSS.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/YzXwxgy?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Upon testing the page with screenreaders, our screenreader's readout confirms that it is receiving the "ADD" text in all caps. Usually, it's totally fine for a screenreader to receive a word in all caps—they're usually smart enough to realize it's just a capitalized word. If you navigate to the above button with VoiceOver, however, you'll learn that VoiceOver has confused the capitalized "ADD" button for the acronym A.D.D.—something it &lt;em&gt;definitely&lt;/em&gt; wouldn't have done if we hadn't changed the CSS.&lt;/p&gt;

&lt;p&gt;These cases of CSS messing with our screenreader announcements are initially shocking, perplexing, and maybe even appalling. After all, they seem to conflict with our mental model of CSS, one that's likely been instilled in us since we started learning web development: HTML is for content, and CSS is for visual appearance. It's the separation of content and presentation. Here, by changing what screenreaders announce, it feels like CSS is encroaching on content territory.&lt;/p&gt;

&lt;p&gt;What is happening here? Do we need to worry about every CSS rule changing screenreader announcements?&lt;/p&gt;

&lt;h2&gt;
  
  
  Smart Browsers
&lt;/h2&gt;

&lt;p&gt;Screenreaders aren't actually looking at the CSS.&lt;/p&gt;

&lt;p&gt;Browsers package up an alternate version of the DOM, called the &lt;a href="https://blog.benmyers.dev/accessibility-tree/"&gt;accessibility tree&lt;/a&gt;, which it passes to the user's operating system for screenreaders and other assistive technology to consume. Every element in the tree is defined as a set of properties that describe the element's purpose and functionality. Screenreaders peruse the tree to know what to announce. Thanks to the hard work of browser engineers, browsers have gotten really smart about building the tree. They can account for web developers' tricks—whether best practices or bad habits—and curate a more usable accessibility tree.&lt;/p&gt;

&lt;p&gt;As much as the web development community talks about the separation of content and presentation, the truth is that it's not that easy. Between using pseudo-elements and toggling &lt;code&gt;display: none;&lt;/code&gt; on elements to show or hide them, it's clear there can be a bit of a gray area between content and its presentation. This gray area provides a key space for browsers to optimize their accessibility trees, giving all screenreader users the same experience of the content as sighted users.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS's Potential Influences on Screenreaders
&lt;/h2&gt;

&lt;p&gt;What kinds of CSS-based optimizations or modifications do browsers make to the accessibility tree? Below, I've listed a few kinds that I know of. I'm sure it's not exhaustive. More importantly, these impacts will depend heavily on the user's choice of operating system, browser, and assistive technology. &lt;a href="https://webaim.org/blog/screen-readers-and-css/"&gt;On the WebAIM blog&lt;/a&gt;, John Northup cautions us,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"It’s tempting to assert that if you do x, 'the screen reader' will announce y. Sometimes it really is just that simple, but in a surprising number of situations, it just isn’t that absolute."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Be sure to test each of the following on many different browsers and with many different screenreaders.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS-Generated Content
&lt;/h3&gt;

&lt;p&gt;The clearest instance of CSS-as-content is &lt;em&gt;pseudo-elements&lt;/em&gt;, which can inject content into the page without adding it to the DOM. For instance, &lt;a href="https://caniuse.com/#feat=css-marker-pseudo"&gt;Firefox and Safari both support&lt;/a&gt; the &lt;a href="https://www.w3.org/TR/css-lists-3/#markers"&gt;&lt;code&gt;::marker&lt;/code&gt;&lt;/a&gt; pseudo-element, which injects a bullet point, number, or other indicator before a list item.&lt;/p&gt;

&lt;p&gt;We can also use the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/::before"&gt;&lt;code&gt;::before&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/::after"&gt;&lt;code&gt;::after&lt;/code&gt;&lt;/a&gt; pseudo-elements to inject content.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/KKpVvLo?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you navigate to the above button with a screenreader, you'll likely hear something like "button, pencil, Edit," assuming your screenreader supports emojis. Lately, browsers interpret the content defined in pseudo-elements as... content. It impacts how sighted users experience the page (and users don't really care whether their content is &lt;em&gt;real&lt;/em&gt; content or &lt;em&gt;pseudo&lt;/em&gt; content), so browsers judge that they need to expose it to screenreaders.&lt;/p&gt;

&lt;p&gt;This judgment call comes from the W3C specs for determining an element's &lt;a href="http://blog.benmyers.dev/aria/#name"&gt;accessible name&lt;/a&gt;, i.e. how it's announced by screenreaders:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Check for CSS generated textual content associated with the current node and include it in the accumulated text. The CSS &lt;code&gt;:before&lt;/code&gt; and &lt;code&gt;:after&lt;/code&gt; pseudo elements can provide textual content for elements that have a content model.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;:before&lt;/code&gt; pseudo elements, User agents &lt;em&gt;MUST&lt;/em&gt; prepend CSS textual content, without a space, to the textual content of the current node.&lt;/li&gt;
&lt;li&gt;For &lt;code&gt;:after&lt;/code&gt; pseudo elements, User agents &lt;em&gt;MUST&lt;/em&gt; append CSS textual content, without a space, to the textual content of the current node.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;—&lt;a href="https://www.w3.org/TR/accname-1.1/#step2F.ii"&gt;Accessible Name and Description Computation 1.1, Step 2(F)(ii)&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Hidden Content
&lt;/h3&gt;

&lt;p&gt;Sometimes, we find ourselves wanting to hide something visually, but still expose it to screenreaders, usually to provide a hint for context that would be obvious visually. In these cases, it's tempting to specify &lt;code&gt;display: none;&lt;/code&gt;. That would hide the contents, but still leave them in the DOM. Mission accomplished, right?&lt;/p&gt;

&lt;p&gt;However, &lt;code&gt;display: none;&lt;/code&gt; is generally used as a toggle, to save the trouble of recreating and reinserting content on command. For instance, you could use &lt;code&gt;display: none;&lt;/code&gt; for inactive tab panels or for whichever slides the carousel is not showing at the moment. When &lt;code&gt;display: none;&lt;/code&gt; is applied to an element, the assumption is generally that users will &lt;em&gt;not&lt;/em&gt; be able to experience that element, and often that it would be confusing or misleading for them to.&lt;/p&gt;

&lt;p&gt;Browsers take &lt;code&gt;display: none;&lt;/code&gt;, as well as similar rules such as &lt;code&gt;visibility: hidden;&lt;/code&gt; and &lt;code&gt;width: 0px; height: 0px;&lt;/code&gt;, as cues that the elements aren't meant to be read by &lt;em&gt;anyone&lt;/em&gt;, and will remove the relevant elements from the accessibility tree accordingly. This is why we resort to tricks such as &lt;a href="https://webaim.org/techniques/css/invisiblecontent/#offscreen"&gt;placing the elements far off screen&lt;/a&gt; or &lt;a href="https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html#hiding-content-visually"&gt;clipping the elements to be really small&lt;/a&gt; to expose information to screenreader users only.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nullifying Semantics
&lt;/h3&gt;

&lt;p&gt;When a user reaches a list in Safari, VoiceOver will usually say something like "list, 2 items." When the user navigates between items, VoiceOver tells them where they are in the list, e.g. "1 of 2." However, as we saw earlier, applying &lt;code&gt;list-style: none;&lt;/code&gt; to the list changed the user's experience entirely. VoiceOver no longer said "list, 2 items," nor did it tell the user how far into the list they were. Instead, it just treated every item as a plain text node. It seems as though Safari's engineers decided lists without bullets or other markers aren't listy enough, and decided to instead nullify the list's semantics. Alternatively, it could be a bug.&lt;/p&gt;

&lt;p&gt;Tables are another area where CSS can lead to changed semantics. Even though tables are supposed to represent tabular data, developers used to (and still sometimes do) put pieces of the page into a table in order to define the layout in terms of rows and columns. In these cases, table semantics are inaccurate.&lt;/p&gt;

&lt;p&gt;Browsers like &lt;a href="https://chromium.googlesource.com/chromium/blink/+/master/Source/modules/accessibility/AXTable.cpp"&gt;Chrome&lt;/a&gt; and &lt;a href="https://dxr.mozilla.org/mozilla-central/source/accessible/generic/TableAccessible.cpp"&gt;Firefox&lt;/a&gt; will make an educated guess at whether a table is used for layout. One factor they consider is tablelike styling such as &lt;a href="https://www.w3schools.com/howto/howto_css_table_zebra.asp"&gt;zebra striping&lt;/a&gt;. On the other hand, specifying &lt;code&gt;display: block|flex|grid&lt;/code&gt; on a table element seems to be an instant disqualifier for tablehood, and &lt;a href="https://developer.paciellogroup.com/blog/2018/03/short-note-on-what-css-display-properties-do-to-table-semantics/"&gt;causes browsers to blow away the table's semantics.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Apparently, &lt;code&gt;display&lt;/code&gt; loves changing if and how elements are announced by screenreaders...&lt;/p&gt;

&lt;h2&gt;
  
  
  An Obligatory Mention of the CSS Speech Module
&lt;/h2&gt;

&lt;p&gt;It doesn't quite fit into this post's theme of browsers optimizing accessibility trees, but a post about how CSS can influence screenreaders would be remiss without a mention of CSS Speech.&lt;/p&gt;

&lt;p&gt;CSS2 contained specs for &lt;a href="https://www.w3.org/TR/CSS21/aural.html#aural-media-group"&gt;aural stylesheets&lt;/a&gt;, which could define speech synthesis properties for screenreaders and any other device that would read a webpage aloud. These properties included volume, pitch, family (i.e. which voice was even used), audio cues that could be announced before and after elements, and more. This was replaced by the &lt;a href="https://www.w3.org/TR/CSS21/media.html%23media-types"&gt;&lt;code&gt;speech&lt;/code&gt; media type&lt;/a&gt; in CSS 2.1, which had no defined properties or values. It was just a reserved keyword.&lt;/p&gt;

&lt;p&gt;In 2012, W3C released the &lt;a href="https://www.w3.org/TR/2018/NOTE-css3-speech-20180605/"&gt;CSS Speech Module&lt;/a&gt; for CSS3 as a Candidate Recommendation to get implementation experience and feedback before formally recommending it. The module was fairly similar to the old aural stylesheets of CSS2, with some additions. For instance, the new &lt;code&gt;speak-as&lt;/code&gt; property dictated how verbose speech synthesizers would be when reading out an element—e.g. spelling out every letter, reading digits individually, or announcing every punctuation mark. Additionally, we could distinguish regular content and live alerts with different voices. However, the module received limited support, and was retired in 2018.&lt;/p&gt;

&lt;p&gt;As of February 2020, it seems like the CSS Speech Module might be making a comeback with a &lt;a href="https://drafts.csswg.org/css-speech-1/"&gt;new Candidate Recommendation&lt;/a&gt;. If this recommendation sees a more widespread adoption, we can expect to use CSS to influence screenreaders even more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With CSS, there is a gray area, for better or for worse, between content and its presentation. When CSS bleeds into content, it can convey important information that might be lost to screenreader users. Browsers have gotten really smart about how they expose that information to screenreaders, but that means that our styles can change screenreader users' experience in unexpected ways. As always, be sure to test with many screenreaders on many browsers and many platforms.&lt;/p&gt;

</description>
      <category>css</category>
      <category>a11y</category>
      <category>webdev</category>
    </item>
    <item>
      <title>New Year, New Terminal: Alias Your Directories the Windows Way</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Thu, 02 Jan 2020 02:15:32 +0000</pubDate>
      <link>https://dev.to/bendmyers/new-year-new-terminal-alias-your-directories-the-windows-way-2cgb</link>
      <guid>https://dev.to/bendmyers/new-year-new-terminal-alias-your-directories-the-windows-way-2cgb</guid>
      <description>&lt;p&gt;&lt;em&gt;This article covers how to alias your directories on Windows, and was originally published &lt;a href="https://blog.benmyers.dev/alias-directories-windows/"&gt;on my blog&lt;/a&gt;. Additionally, you may be interested in &lt;a href="https://dev.to/bendmyers/new-year-new-terminal-alias-your-directories-the-unix-way-4dal"&gt;the Unix way&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I admit it. I'm a sucker for creating little shortcuts and scripts to speed up work in my terminal. There's just something oddly thrilling about typing a few characters and kicking off several commands. I recently read Chiamaka Ikeanyi's &lt;a href="https://chiamakaikeanyi.dev/avoiding-shell-hell-aliases-to-the-rescue/"&gt;Avoiding Shell Hell: Aliases to the Rescue&lt;/a&gt;, and I was inspired to share some alias tricks I use on a daily basis.&lt;/p&gt;

&lt;p&gt;My team at work manages six projects. Each project has its own repository. Additionally, we have repositories for developer tools made by the team. Combine that with any other directories we use on a daily basis, and &lt;code&gt;cd&lt;/code&gt; quickly becomes our most frequent command.&lt;/p&gt;

&lt;p&gt;My favorite terminal trick, for both my home and work computers, is creating short, memorable aliases to &lt;code&gt;cd&lt;/code&gt; to my most frequent directories. If I want to write a new post, I just type &lt;code&gt;blog&lt;/code&gt; and I'm in my Gatsby codebase. If I need to tweak the response from a mock server, I type &lt;code&gt;mock&lt;/code&gt;, and I can start poking around my Express.js code. I rarely have to worry about long, complex relative paths. The terminal feels snappier, more intuitive, and—best of all—more &lt;em&gt;fun&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Aliases with Doskey
&lt;/h2&gt;

&lt;p&gt;You'll want to pick a frequently used directory and a memorable command you'll use to hop to that directory. In my case, I want to run the &lt;code&gt;blog&lt;/code&gt; command to go to &lt;code&gt;C:\Ben\blog&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In Windows, you can use the &lt;code&gt;doskey&lt;/code&gt; command to create aliases to use in Command Prompt. Open up Command Prompt and run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\&amp;gt; doskey  blog=cd  C:\Ben\blog
C:\&amp;gt; blog
C:\Ben\blog&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works like a charm! However, if you close and reopen Command Prompt, you'll run into a bit of a problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\&amp;gt; blog
'blog' is not recognized as an internal or external command,
operable program or batch file.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;doskey&lt;/code&gt; aliases don't persist between sessions. Instead, we have to put them in a persistent batch file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persisting Doskey Aliases
&lt;/h2&gt;

&lt;p&gt;Whereas Unix has &lt;code&gt;.bashrc&lt;/code&gt; that runs with every new terminal session, Windows has no such files. We'll need to create our own.&lt;/p&gt;

&lt;p&gt;Create a &lt;code&gt;.bat&lt;/code&gt; file. You can call it whatever—&lt;code&gt;aliases.bat&lt;/code&gt;, &lt;code&gt;scripts.bat&lt;/code&gt;, &lt;code&gt;doskey.bat&lt;/code&gt;…—so long as it works for you. I'll call mine &lt;code&gt;aliases.bat&lt;/code&gt; and place it in the home directory.&lt;/p&gt;

&lt;p&gt;Inside this batch file, I'll put:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;@echo &lt;span class="na"&gt;off&lt;/span&gt;
&lt;span class="nb"&gt;doskey&lt;/span&gt; &lt;span class="kd"&gt;blog&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="kd"&gt;C&lt;/span&gt;:\Ben\blog\

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(That &lt;code&gt;@echo off&lt;/code&gt; is to make sure the terminal doesn't vomit out the whole &lt;code&gt;aliases.bat&lt;/code&gt; file whenever you start a new session.)&lt;/p&gt;

&lt;p&gt;The next step is making sure Command Prompt knows to run your batch file whenever you start a new terminal session. To do this, we need to make a change to the Windows Registry—your Windows machine's operating system-level configurations. We'll add a configuration that specifies that whenever Command Prompt starts a new session, it should automatically run &lt;code&gt;aliases.bat&lt;/code&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open the Registry Editor.&lt;/strong&gt; Open up the Start menu, and search for &lt;em&gt;regedit&lt;/em&gt;. Click the &lt;em&gt;Registry Editor&lt;/em&gt; result.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Navigate to the Command Processor settings.&lt;/strong&gt;  This can be found at &lt;em&gt;HKEY_CURRENT_USER&lt;/em&gt; → &lt;em&gt;Software&lt;/em&gt; → &lt;em&gt;Microsoft&lt;/em&gt; → &lt;em&gt;Command Processor&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add an &lt;em&gt;AutoRun&lt;/em&gt; value.&lt;/strong&gt; Right-click inside &lt;em&gt;Command Processor&lt;/em&gt; and choose &lt;em&gt;New&lt;/em&gt; → &lt;em&gt;String Value&lt;/em&gt;. Give the new property the name &lt;code&gt;AutoRun&lt;/code&gt;. Make the value the absolute path to your batch file of aliases.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Open a new session of Command Prompt, and try out your new aliases!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\&amp;gt; blog
C:\Ben\blog&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're good to go!&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Persistent Doskey Aliases on the Fly
&lt;/h2&gt;

&lt;p&gt;I like having an alias for just about any directory or workspace I might come back to. Manually modifying &lt;code&gt;aliases.bat&lt;/code&gt; and restarting my terminal every time I create a directory would interrupt my flow, however. Instead, I have a batch script that automatically creates a persistent &lt;code&gt;doskey&lt;/code&gt; alias to the current working directory whenever I use the &lt;code&gt;ad&lt;/code&gt; command.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a folder to store your scripts in.&lt;/strong&gt; I called my folder &lt;code&gt;C:\Ben\Batch&lt;/code&gt;, but you can call it &lt;code&gt;Scripts&lt;/code&gt; or &lt;code&gt;Commands&lt;/code&gt; or any other meaningful name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Add your scripts folder to your PATH.&lt;/strong&gt; If you haven't done this before, check out &lt;a href="https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/"&gt;Ryan Hoffman's quick guide&lt;/a&gt;. When you run an unfamiliar command, the terminal checks all directories listed in the PATH to see whether any of them have a script or executable file with the same name. For instance, if you run &lt;code&gt;ad&lt;/code&gt;, the terminal checks all directories in the PATH for an executable file called &lt;code&gt;ad&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create an &lt;code&gt;ad.bat&lt;/code&gt; inside your scripts folder.&lt;/strong&gt; By calling this file &lt;code&gt;ad.bat&lt;/code&gt;, you ensure that the file is executed whenever you run the command &lt;code&gt;ad&lt;/code&gt;. If you'd prefer to use a different command, you can choose a different name. Paste the following into your new batch file:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;@echo &lt;span class="na"&gt;off&lt;/span&gt;
&lt;span class="kd"&gt;SETLOCAL&lt;/span&gt;

&lt;span class="c"&gt;REM Verify exactly one argument was passed&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="s2"&gt;~1"&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="k"&gt;goto&lt;/span&gt; &lt;span class="kd"&gt;usage&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="s2"&gt;~2"&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="k"&gt;goto&lt;/span&gt; &lt;span class="kd"&gt;usage&lt;/span&gt;

&lt;span class="c"&gt;REM Verify alias doesn't already exist&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="na"&gt;/f &lt;/span&gt;&lt;span class="s2"&gt;"tokens=*"&lt;/span&gt; &lt;span class="vm"&gt;%%a&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'doskey /macros:all &lt;/span&gt;&lt;span class="se"&gt;^|&lt;/span&gt;&lt;span class="s1"&gt; findstr &lt;/span&gt;&lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="s1"&gt;1='&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="kd"&gt;foundAlias&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="vm"&gt;%%a&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%foundAlias%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="k"&gt;goto&lt;/span&gt; &lt;span class="kd"&gt;alias_exists&lt;/span&gt;

&lt;span class="k"&gt;goto&lt;/span&gt; &lt;span class="kd"&gt;add_alias&lt;/span&gt;

&lt;span class="nl"&gt;:usage&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;USAGE&lt;/span&gt;: &lt;span class="kd"&gt;ad&lt;/span&gt; &lt;span class="se"&gt;^&amp;lt;&lt;/span&gt;&lt;span class="kd"&gt;alias&lt;/span&gt;&lt;span class="se"&gt;^&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;

&lt;span class="nl"&gt;:alias&lt;/span&gt;_exists
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;Alias&lt;/span&gt; &lt;span class="kd"&gt;already&lt;/span&gt; &lt;span class="kd"&gt;exists&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;
&lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;

&lt;span class="nl"&gt;:add&lt;/span&gt;_alias
&lt;span class="nb"&gt;echo&lt;/span&gt;.doskey &lt;span class="err"&gt;%&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="nv"&gt;%cd%&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="s2"&gt;"C:\Ben\aliases.bat"&lt;/span&gt;
&lt;span class="k"&gt;call&lt;/span&gt; &lt;span class="s2"&gt;"C:\Ben\aliases.bat"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;Alias&lt;/span&gt; &lt;span class="kd"&gt;was&lt;/span&gt; &lt;span class="kd"&gt;added&lt;/span&gt; &lt;span class="kd"&gt;successfully&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;
&lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Replace the paths in lines 23 and 24 with the absolute path to your &lt;code&gt;aliases.bat&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Make sure your &lt;code&gt;aliases.bat&lt;/code&gt; file ends in a trailing newline.&lt;/strong&gt; You'll only need to do this once, unless you manually add stuff to your &lt;code&gt;aliases.bat&lt;/code&gt; later, but this tripped me up for an embarassingly long time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open a new session of Command Prompt and alias a directory.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;C:\&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;Ben&lt;span class="se"&gt;\A&lt;/span&gt;dvent_Of_Code_2019
&lt;span class="gp"&gt;C:\Ben\Advent_Of_Code_2019&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;ad advent
&lt;span class="go"&gt;Alias was added successfully!
&lt;/span&gt;&lt;span class="gp"&gt;C:\Ben\Advent_Of_Code_2019&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ../..
&lt;span class="gp"&gt;C:\&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;advent
&lt;span class="gp"&gt;C:\Ben\Advent_Of_Code_2019&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm still very new to batch scripting, so if you find a problem with this script or a way to improve it, &lt;a href="https://www.twitter.com/BenDMyers"&gt;please reach out&lt;/a&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Tweaking my terminal makes programming a more delightful experience for me, and it can for you, too. By aliasing &lt;code&gt;cd&lt;/code&gt; commands to your most frequently used directories, you cut down on having to juggle potentially long absolute or relative paths. Using the terminal becomes faster, more intuitive, and personal. What's not to love?&lt;/p&gt;

</description>
      <category>terminal</category>
      <category>batch</category>
      <category>windows</category>
      <category>shellscripting</category>
    </item>
    <item>
      <title>New Year, New Terminal: Alias Your Directories the Unix Way</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Thu, 02 Jan 2020 02:15:14 +0000</pubDate>
      <link>https://dev.to/bendmyers/new-year-new-terminal-alias-your-directories-the-unix-way-4dal</link>
      <guid>https://dev.to/bendmyers/new-year-new-terminal-alias-your-directories-the-unix-way-4dal</guid>
      <description>&lt;p&gt;&lt;em&gt;This article covers how to alias your directories on Unix, and was originally published &lt;a href="https://blog.benmyers.dev/alias-directories-unix/"&gt;on my blog&lt;/a&gt;. Additionally, you may be interested in &lt;a href="https://dev.to/bendmyers/new-year-new-terminal-alias-your-directories-the-windows-way-2cgb"&gt;the Windows way&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I admit it. I'm a sucker for creating little shortcuts and scripts to speed up work in my terminal. There's just something oddly thrilling about typing a few characters and kicking off several commands. I recently read Chiamaka Ikeanyi's &lt;a href="https://chiamakaikeanyi.dev/avoiding-shell-hell-aliases-to-the-rescue/"&gt;Avoiding Shell Hell: Aliases to the Rescue&lt;/a&gt;, and I was inspired to share some alias tricks I use on a daily basis.&lt;/p&gt;

&lt;p&gt;My team at work manages six projects. Each project has its own repository. Additionally, we have repositories for developer tools made by the team. Combine that with any other directories we use on a daily basis, and &lt;code&gt;cd&lt;/code&gt; quickly becomes our most frequent command.&lt;/p&gt;

&lt;p&gt;My favorite terminal trick, for both my home and work computers, is creating short, memorable aliases to &lt;code&gt;cd&lt;/code&gt; to my most frequent directories. If I want to write a new post, I just type &lt;code&gt;blog&lt;/code&gt; and I'm in my Gatsby codebase. If I need to tweak the response from a mock server, I type &lt;code&gt;mock&lt;/code&gt;, and I can start poking around my Express.js code. I rarely have to worry about long, complex relative paths. The terminal feels snappier, more intuitive, and—best of all—more &lt;em&gt;fun&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Aliases
&lt;/h2&gt;

&lt;p&gt;Pick a directory you use often, and a memorable alias you'll use to hop to that directory instantly. In my case, I want to go to my &lt;code&gt;~/blog&lt;/code&gt; directory whenever I use my &lt;code&gt;blog&lt;/code&gt; alias.&lt;/p&gt;

&lt;p&gt;Let's give it a shot! In your terminal, run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ alias blog="cd ~/blog"
~$ cd some/other/directory/
~/some/other/directory$ blog
~/blog$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No matter which working directory we're in, issuing the &lt;code&gt;blog&lt;/code&gt; command now takes us directly to &lt;code&gt;~/blog&lt;/code&gt;. Mission accomplished! We can close our terminal and call it a day.&lt;/p&gt;

&lt;p&gt;Next time, we can just open up our terminal and...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ blog
-bash: blog: command not found
~$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;... oh.&lt;/p&gt;

&lt;p&gt;Aliases only last as long as the terminal session. Since manually reestablishing our aliases every time we open the terminal would be a bit of a hassle, let's find a way to make our aliases persist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persisting Bash Aliases
&lt;/h2&gt;

&lt;p&gt;When you start a new interactive shell, your terminal runs a file called &lt;code&gt;.bashrc&lt;/code&gt;, found in your root directory. Open &lt;code&gt;~/.bashrc&lt;/code&gt; in your editor of choice. I'm using VS Code, but you could also use vi, emacs, nano, Atom, or whatever other editor floats your boat:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ code ~/.bashrc
~$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(If &lt;code&gt;.bashrc&lt;/code&gt; doesn't exist, go ahead and create it!)&lt;/p&gt;

&lt;p&gt;We can drop our new alias in and save:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;blog&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"cd ~/blog"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Back in our terminal, we tell our terminal to rerun &lt;code&gt;.bashrc&lt;/code&gt; and receive our new aliases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ source ~/.bashrc
~$ blog
~/blog$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In future terminal sessions, you won't even have to run &lt;code&gt;source&lt;/code&gt;, since the terminal takes care of that for you. You'll be able to just run &lt;code&gt;blog&lt;/code&gt; to your heart's content.&lt;/p&gt;

&lt;h2&gt;
  
  
  But Wait! I Have a Mac!
&lt;/h2&gt;

&lt;p&gt;The default macOS Terminal inexplicably treats &lt;em&gt;every&lt;/em&gt; terminal session as a login session. This means that instead of running &lt;code&gt;~/.bashrc&lt;/code&gt; on every session, the macOS Terminal runs &lt;code&gt;~/.bash_profile&lt;/code&gt;. Cue facepalm.&lt;/p&gt;

&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; account for this by just stuffing your aliases in &lt;code&gt;.bash_profile&lt;/code&gt;. However, if you think you might want to use a different terminal at some point, the more resilient approach would be to have your &lt;code&gt;.bash_profile&lt;/code&gt; source &lt;code&gt;.bashrc&lt;/code&gt; on every login:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; ~/.bashrc &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information, &lt;a href="https://scriptingosx.com/2017/04/about-bash_profile-and-bashrc-on-macos/"&gt;read this handy Scripting OS X guide to &lt;code&gt;.bash_profile&lt;/code&gt; and &lt;code&gt;.bashrc&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Bash Aliases on the Fly
&lt;/h2&gt;

&lt;p&gt;We can use Bash scripting to be even cuter about aliasing our directories. I like having an alias for just about any directory or workspace I might come back to. Manually modifying &lt;code&gt;.bashrc&lt;/code&gt; and re-sourcing every time I create a directory would interrupt my flow, however. Instead, I have a quick script that automatically creates a persistent alias to the current working directory whenever I use the &lt;code&gt;ad&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Copy the following into your &lt;code&gt;~/.bashrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;function &lt;/span&gt;ad&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="s2"&gt;"$#"&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; 1 &lt;span class="o"&gt;]]&lt;/span&gt;
    &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"USAGE: ad &amp;lt;alias&amp;gt;"&lt;/span&gt;
        &lt;span class="k"&gt;return &lt;/span&gt;0
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; 2&amp;gt;/dev/null&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;
    &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Alias already exists!"&lt;/span&gt;
        &lt;span class="k"&gt;return &lt;/span&gt;0
    &lt;span class="k"&gt;fi

    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"alias &lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;cd &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
    &lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Alias was added successfully."&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The interesting lines are 12 and 13 — the rest is just sanity checks.&lt;/p&gt;

&lt;p&gt;Let's give our new &lt;code&gt;ad&lt;/code&gt; command a whirl! If you're using an old terminal session, update your terminal's aliases with &lt;code&gt;source ~/.bashrc&lt;/code&gt;. Then try using &lt;code&gt;ad&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~$ cd ./codebase/Advent_Of_Code_2019
~/codebase/Advent_Of_Code_2019$ ad advent
Alias was added successfully.
~/codebase/Advent_Of_Code_2019$ cd ~
~$ advent
~/codebase/Advent_Of_Code_2019$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ad&lt;/code&gt; has so thoroughly integrated itself into my day-to-day development work that I don't often create a new directory without instantly creating an alias for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Tweaking my terminal makes programming a more delightful experience for me, and it can for you, too. By aliasing &lt;code&gt;cd&lt;/code&gt; commands to your most frequently used directories, you cut down on having to juggle potentially long absolute or relative paths. Using the terminal becomes faster, more intuitive, and personal. What's not to love?&lt;/p&gt;

</description>
      <category>bash</category>
      <category>unix</category>
      <category>terminal</category>
      <category>shellscripting</category>
    </item>
    <item>
      <title>What Is ARIA?</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Sat, 07 Dec 2019 17:04:33 +0000</pubDate>
      <link>https://dev.to/bendmyers/what-is-aria-38ed</link>
      <guid>https://dev.to/bendmyers/what-is-aria-38ed</guid>
      <description>&lt;p&gt;&lt;em&gt;This post was originally published &lt;a href="https://blog.benmyers.dev/aria/"&gt;on my blog&lt;/a&gt;. I recommend reading it there, mainly because the examples are better embedded.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;It's no secret that today's websites are increasingly complex. Webpages now more closely resemble dynamic, living applications. Developers combine and style HTML elements to create new user experiences. However, it can be challenging for disabled users' assistive technologies to make sense of this new world.&lt;/p&gt;

&lt;p&gt;One tool devised to solve this problem is ARIA. Short for &lt;em&gt;Accessible Rich Internet Applications&lt;/em&gt;, ARIA is a subset of HTML attributes (generally prefixed with &lt;code&gt;aria-&lt;/code&gt;) that modify how assistive technologies such as screenreaders navigate your page.&lt;/p&gt;

&lt;p&gt;Unfortunately, developers often misunderstand ARIA and misapply it, which leads to worse experiences for disabled users. In 2017, the web accessibility resource WebAIM reported:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"When WebAIM evaluates a client’s website for accessibility, we often spend more time evaluating and reporting on ARIA use than any other issue. Almost every report we write includes a section cautioning against ARIA abuse and outlining ARIA uses that need to be corrected or, most often, removed."&lt;br&gt;
—Jon Whiting, &lt;a href="https://webaim.org/blog/aria-cause-solution/"&gt;To ARIA! The Cause of, and Solution to, All Our Accessibility Problems&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In &lt;a href="https://webaim.org/projects/million/update#aria"&gt;their August 2019 analysis of the one million most popular homepages&lt;/a&gt;, WebAIM found that ARIA usage had increased sharply over the previous six months, and that the increased use of ARIA was strongly correlated with an increase in accessibility defects on the page.&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--FcCz5y2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/785321310809264128/nCEwZMKr_normal.jpg" alt="Jared Smith profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Jared Smith
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @jared_w_smith
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ir1kO05j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      I’m crunching data for the WebAIM Million re-analysis. The single strongest indicator that a page will have numerous accessibility errors is whether ARIA is present. Pages with ARIA have 65% more issues than those without. And it’s getting worse. This is VERY disturbing!
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      18:50 PM - 29 Aug 2019
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1167147412281933826" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFnoeFxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-reply-action-238fe0a37991706a6880ed13941c3efd6b371e4aefe288fe8e0db85250708bc4.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1167147412281933826" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6dcrOn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-retweet-action-632c83532a4e7de573c5c08dbb090ee18b348b13e2793175fea914827bc42046.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/like?tweet_id=1167147412281933826" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SRQc9lOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-like-action-1ea89f4b87c7d37465b0eb78d51fcb7fe6c03a089805d7ea014ba71365be5171.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;The WebAIM report is quick to remind us that correlation does not imply causation. It suggests that more complex homepages and the use of libraries and frameworks could lead to both more situations requiring ARIA and more bugs. That said, it still seems like there's a lack of understanding around what ARIA is and how it should be used well.&lt;/p&gt;

&lt;p&gt;This could be because &lt;a href="https://www.w3.org/TR/wai-aria-1.1/#state_prop_def"&gt;there are a lot of ARIA attributes&lt;/a&gt;, each with their own (admittedly, sometimes niche) use cases. This can make ARIA seem unapproachable.&lt;/p&gt;

&lt;p&gt;Additionally, ARIA isn't always included in web development resources. When it is, it's often handwaved away as just making the element ✨&lt;em&gt;more accessible&lt;/em&gt;✨. A friend of mine admitted to copying ARIA from example code because the docs promised exactly that. Without the context of what ARIA does, it's totally reasonable for developers to assume that more ARIA means better accessibility, so you might as well go all in.&lt;/p&gt;

&lt;p&gt;So, today: what ARIA is, what it does, why you should use it, and when you shouldn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Revisiting the Accessibility Tree
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://blog.benmyers.dev/accessibility-tree/"&gt;my last post&lt;/a&gt;, I introduced the accessibility tree: an alternate DOM that browsers create specifically for assistive technologies. These accessibility trees describe the page in terms of accessible objects: data structures provided by the operating system that represent different kinds of UI elements and controls, such as text nodes, checkboxes, or buttons.&lt;/p&gt;

&lt;p&gt;Accessible objects describe UI elements as sets of properties. For example, properties that could describe a checkbox include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether it is checked or unchecked&lt;/li&gt;
&lt;li&gt;Its label&lt;/li&gt;
&lt;li&gt;The fact that it even is a checkbox, as opposed to other elements&lt;/li&gt;
&lt;li&gt;Whether it is enabled or disabled&lt;/li&gt;
&lt;li&gt;Whether it can be focused with the keyboard&lt;/li&gt;
&lt;li&gt;Whether it is currently focused with the keyboard&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can break these attributes into four types:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; What kind of UI element is this? Is it text, a button, a checkbox, or something else? This lays out expectations for what this element is doing here, how to interact with this element, and what will happen if you do interact with it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; A label or identifier for this element. Names are used by screenreaders to announce an element, and speech recognition users can use names in their voice commands to target specific elements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State:&lt;/strong&gt; What attributes about this element are subject to change? If this element is part of a field, does it have a value? Is the current value invalid? Does this field have a disabled state?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Properties:&lt;/strong&gt; Functional aspects of an element that would be relevant to a user or an assistive technology, but aren't as subject to change as state. Is this element focusable with the keyboard? Does it have a longer-form description? Is this element connected to other elements in some way?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These qualities encompass everything a user might want to know about the &lt;em&gt;function&lt;/em&gt; of an element, while omitting everything about the element's appearance or presentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Good Markup Means Happy Trees
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Semantic markup&lt;/em&gt; refers to using the native HTML elements that best reflect the desired experience. For instance, if you want an element that, when clicked, submits a form or performs some action on the page, &lt;a href="https://blog.benmyers.dev/clickable-divs/"&gt;it's &lt;em&gt;usually&lt;/em&gt; best to use a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; tag&lt;/a&gt;. When we write semantic HTML, the browser has a much easier time picking out the right accessible objects. Additionally, the browser can do the heavy lifting to make sure the accessible objects have all of the necessary properties, without any extra effort on our part.&lt;/p&gt;

&lt;p&gt;However, semantics can only get us so far. Sometimes we want &lt;a href="https://developer.paciellogroup.com/blog/2014/10/aria-in-html-there-goes-the-neighborhood/#html5na"&gt;newer, more complex experiences that semantic elements just don't support yet&lt;/a&gt;, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Messaging that is subject to change, including error messages&lt;/li&gt;
&lt;li&gt;Tabs, tablists, and tabpanels&lt;/li&gt;
&lt;li&gt;Tooltips&lt;/li&gt;
&lt;li&gt;Toggle switches&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What do we do in these cases? It's still important to engineer these experiences in ways that assistive technologies can understand. First, we get as far as we possibly can with semantic markup. Then, we use HTML's ARIA attributes to tweak the accessibility tree.&lt;/p&gt;

&lt;p&gt;ARIA doesn't modify the DOM or add new functionality to elements. It won't change elements' behavior in any way. &lt;strong&gt;ARIA exclusively manipulates elements' representation in the accessibility tree.&lt;/strong&gt; In other words, ARIA is used to modify an element's role, name, state, and properties for assistive technologies.&lt;/p&gt;

&lt;p&gt;That's great in theory, but how does it work in practice?&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing the Toggle
&lt;/h2&gt;

&lt;p&gt;Take a look at this toggle switch:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/jOOReJG?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you click the toggle, you'll trigger dark mode. Click it again and you'll go back to light mode. The toggle is even keyboard-navigable—you can tab to it and trigger it by pressing Space.&lt;/p&gt;

&lt;p&gt;It does have a bit of a problem, though. If you navigate to it with a screenreader, you'll hear something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--74ionVQG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/group.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--74ionVQG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/group.png" alt='VoiceOver announcement, which simply reads "group"' width="880" height="178"&gt;&lt;/a&gt;&lt;/p&gt;
This is... underwhelming.



&lt;p&gt;Screenreader users will have no idea what this element is, or what it's for, or even that it's clickable. Users of other assistive technologies will be similarly frustrated. This is what we in the business call A Problem™. Fortunately, we can try to fix this with ARIA. We'll explore how ARIA modifies names, roles, states, and properties by adding ARIA attributes to this dark mode toggle.&lt;/p&gt;

&lt;p&gt;If you'd like to pull the code locally to follow along, you can &lt;a href="https://github.com/BenDMyers/ARIA_Toggle_Example"&gt;clone it from GitHub&lt;/a&gt;. If you don't have a screenreader to follow along with, follow &lt;a href="https://blog.benmyers.dev/accessibility-tree/#from-the-dom-to-the-accessibility-tree"&gt;these steps to view your browser's accessibility tree&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First up, how do we make sure assistive technologies know that our element is a toggle instead of a group?&lt;/p&gt;

&lt;h2&gt;
  
  
  Role
&lt;/h2&gt;

&lt;p&gt;The browser doesn't really know what to make of our toggle, or how best to expose it to assistive technology. Because our toggle is just a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; with another &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; inside of it, the browser's best guess is that this is a generic group of elements. Unfortunately, this doesn't help users of assistive technologies understand what this element is or how they should interact with it.&lt;/p&gt;

&lt;p&gt;We can help the browser along by providing our toggle with a &lt;code&gt;role&lt;/code&gt; attribute. &lt;code&gt;role&lt;/code&gt; can take &lt;a href="https://www.w3.org/TR/html-aria/#aria-table"&gt;many possible values&lt;/a&gt; such as &lt;code&gt;button&lt;/code&gt;, &lt;code&gt;link&lt;/code&gt;, &lt;code&gt;slider&lt;/code&gt;, or &lt;code&gt;table&lt;/code&gt;. Some of these values have corresponding semantic HTML elements, but &lt;a href="https://developer.paciellogroup.com/blog/2014/10/aria-in-html-there-goes-the-neighborhood/#html5na"&gt;some do not&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We want to pick the role that best describes our toggle element. In our case, there are two roles that describe elements that alternate between two opposite states: &lt;code&gt;checkbox&lt;/code&gt; and &lt;code&gt;switch&lt;/code&gt;. These roles are functionally very similar, except that &lt;code&gt;checkbox&lt;/code&gt;'s states are &lt;em&gt;checked&lt;/em&gt; and &lt;em&gt;unchecked&lt;/em&gt;, and &lt;code&gt;switch&lt;/code&gt; uses &lt;em&gt;on&lt;/em&gt; and &lt;em&gt;off&lt;/em&gt;. &lt;a href="https://scottaohara.github.io/a11y_styled_form_controls/src/checkbox--switch/#affects_on_sr"&gt;The &lt;code&gt;switch&lt;/code&gt; role also has weaker support than &lt;code&gt;checkbox&lt;/code&gt;.&lt;/a&gt; We'll go ahead and use &lt;code&gt;switch&lt;/code&gt;, but you're free to use &lt;code&gt;checkbox&lt;/code&gt; on your own.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/BaaEeXp?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;When we navigate to our toggle with a screenreader now, we get a more accurate description of this element:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MVJ2d79F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/off-switch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MVJ2d79F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/off-switch.png" alt='VoiceOver announcement, which reads "off, switch"' width="880" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I lingered on this element for a bit with VoiceOver active, VoiceOver told me how I could interact with the element using the Space key:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6l-FNN1X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/switch-instr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6l-FNN1X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/switch-instr.png" alt="VoiceOver announcement, which instructs the user to interact with the switch by using the Space key" width="880" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Assistive technologies can now use these roles to provide extra functionalities that make navigating the page easier for disabled users. For instance, when a user issues a "click button" voice command, the Dragon NaturallySpeaking speech recognition software will light up all of the buttons on the page. Screenreaders often provide shortcuts for navigating between different elements of the same role—JAWS provides hotkeys and VoiceOver provides the Rotor for this purpose.&lt;/p&gt;

&lt;p&gt;Importantly, &lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/#principle-1-a-role-is-a-promise"&gt;a role is a promise&lt;/a&gt;. You're promising to users that they can interact with elements in a certain way and that they will behave predictably. For instance, users will expect the following from switches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They can be clicked&lt;/li&gt;
&lt;li&gt;They can be focused on with the keyboard&lt;/li&gt;
&lt;li&gt;When the switch is focused, it can be triggered by clicking Space&lt;/li&gt;
&lt;li&gt;Triggering the switch will cause something to toggle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Specifying an element's &lt;code&gt;role&lt;/code&gt; will &lt;em&gt;not&lt;/em&gt; auto-magically add any of that expected functionality. It won't make our element focusable or add key events. It's up to the developer to follow through on that promise. In the case of our toggle, I've already handled this with &lt;code&gt;tabindex&lt;/code&gt; and by adding a &lt;code&gt;keydown&lt;/code&gt; event listener.&lt;/p&gt;

&lt;p&gt;It's great that users and assistive technologies know our element is a toggle switch. Now, though, they might be asking themselves... a toggle switch for &lt;em&gt;what&lt;/em&gt;?&lt;/p&gt;

&lt;h2&gt;
  
  
  Name
&lt;/h2&gt;

&lt;p&gt;An element's accessible name is its label or identifier. Screenreaders announce an element's name when the user navigates to that element. Speech recognition users may also use an element's name to target that element in a voice command. Images' names come from their &lt;code&gt;alt&lt;/code&gt; text, and form fields will get their names from their associated &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; elements. Most elements get their names from their text contents.&lt;/p&gt;

&lt;p&gt;Sometimes, the default accessible name isn't good enough. Some cases where manually setting the accessible name would be justified include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Short, repeated links like "Read more" whose context is made clear to sighted users, but which need more context to make them distinct to assistive technologies&lt;/li&gt;
&lt;li&gt;Icon buttons that have no meaningful text contents&lt;/li&gt;
&lt;li&gt;Regions of the page that should be labeled so that assistive technologies can build a skimmable page outline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ARIA offers two attributes for modifying an element's name: &lt;code&gt;aria-label&lt;/code&gt; and &lt;code&gt;aria-labelledby&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;When you specify &lt;code&gt;aria-label&lt;/code&gt; on an element, you override any name that element had, and you replace it with the contents of that &lt;code&gt;aria-label&lt;/code&gt; attribute. Take a button that just has a magnifying glass icon. We could use &lt;code&gt;aria-label&lt;/code&gt; to have screenreaders override the button's contents and announce "Search":&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;button&lt;/span&gt; &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Search"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 22 22"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="c"&gt;&amp;lt;!-- Some magnifying glass SVG icon --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's add &lt;code&gt;aria-label&lt;/code&gt; to our toggle:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/OJJGaPW?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;If you navigate to the switch with a screenreader now, you'll hear something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TMfDZnoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/role.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TMfDZnoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/role.png" alt='VoiceOver announcement, which reads "Use dark mode, off, switch"' width="880" height="178"&gt;&lt;/a&gt;&lt;/p&gt;
Adding a label has gone a long way towards making this element understandable.



&lt;p&gt;&lt;code&gt;aria-label&lt;/code&gt; is best used when there isn't already some visible text label on the page. Alternatively, if we already have a label on the page, we could use &lt;code&gt;aria-labelledby&lt;/code&gt;. &lt;code&gt;aria-labelledby&lt;/code&gt; takes a text label's &lt;code&gt;id&lt;/code&gt;, and uses that label's contents as an accessible name.&lt;/p&gt;

&lt;p&gt;For instance, we could use &lt;code&gt;aria-labelledby&lt;/code&gt; to use a header as a label for a table of contents section. The &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; uses the heading's &lt;code&gt;id&lt;/code&gt; to specify which element should serve as its label. As a result, the whole table of contents section is named "Table of Contents."&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;section&lt;/span&gt; &lt;span class="na"&gt;aria-labelledby=&lt;/span&gt;&lt;span class="s"&gt;"toc-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"toc-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        Table of Contents
    &lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;ol&amp;gt;&lt;/span&gt;
        &lt;span class="c"&gt;&amp;lt;!-- List items here --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/ol&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach is very similar to using a &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; element's &lt;code&gt;for&lt;/code&gt; attribute, except it works for all elements, not just form fields.&lt;/p&gt;

&lt;p&gt;Here's what our toggle example would look like if we used &lt;code&gt;aria-labelledby&lt;/code&gt; instead of &lt;code&gt;aria-label&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/dyyLQvY?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; While writing this article, I learned that &lt;a href="http://www.davidmacd.com/blog/does-aria-label-override-static-text.html"&gt;screenreaders may disregard &lt;code&gt;aria-label&lt;/code&gt; and &lt;code&gt;aria-labelledby&lt;/code&gt; for static elements&lt;/a&gt;. If your labels aren't working, make sure your element has either a &lt;a href="https://www.washington.edu/accessibility/web/landmarks/"&gt;landmark role&lt;/a&gt; or a role that implies interactivity.&lt;/p&gt;

&lt;h2&gt;
  
  
  State
&lt;/h2&gt;

&lt;p&gt;When I navigate to our toggle with my screenreader, it tells me that it's in an "off" state. However, when I trigger the toggle... it still says it's off. We need a way to let assistive technologies know when the toggle's state has changed.&lt;/p&gt;

&lt;p&gt;ARIA state attributes describe properties of an element that are subject to change in ways that are relevant for the user. They're dynamic. For instance, &lt;a href="https://inclusive-components.design/collapsible-sections/"&gt;collapsible sections&lt;/a&gt; let users click a button to expand or collapse the contents. When a screenreader user is focused on that button, it would probably be helpful if they knew whether the contents were currently expanded or collapsed. We could set &lt;code&gt;aria-expanded="false"&lt;/code&gt; on the button and then dynamically change the value whenever the button is clicked.&lt;/p&gt;

&lt;p&gt;Another ARIA state attribute worth mentioning is &lt;code&gt;aria-hidden&lt;/code&gt;. Whenever an element has &lt;code&gt;aria-hidden="true"&lt;/code&gt;, it and any of its children are immediately removed from the accessibility tree. Assistive technologies that use the tree will have no idea that this element exists. This is useful for presentational elements that decorate the page but would create a cluttered screenreader experience. &lt;code&gt;aria-hidden&lt;/code&gt; can also be dynamically toggled, e.g. to obscure page contents from screenreaders when a modal overlay is open.&lt;/p&gt;

&lt;p&gt;Returning to our toggle, elements that have specified &lt;code&gt;role="checkbox"&lt;/code&gt; or &lt;code&gt;role="switch"&lt;/code&gt; expect that the element will have the &lt;code&gt;aria-checked&lt;/code&gt; state attribute, and that it will alternate between &lt;code&gt;"true"&lt;/code&gt; and &lt;code&gt;"false"&lt;/code&gt; whenever the toggle is triggered.&lt;/p&gt;

&lt;p&gt;The following example demonstrates how we can use JavaScript to change &lt;code&gt;aria-checked&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/zYYXgOG?height=600&amp;amp;default-tab=js,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Try navigating to the toggle with your screenreader. Flip the switch to turn dark mode on. Now, the toggle actually announces when it's on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZEc3jsMP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/switch-state.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZEc3jsMP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.benmyers.dev/aria/switch-state.png" alt='VoiceOver announcement, which reads "on, Use dark mode, switch"' width="880" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Properties
&lt;/h2&gt;

&lt;p&gt;ARIA properties are attributes that describes extra context about an element that would be useful for a user to know, but aren't subject to change like state. Some examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Marking up form fields with &lt;code&gt;aria-required&lt;/code&gt; or &lt;code&gt;aria-readonly&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;aria-haspopup&lt;/code&gt; to indicate that a button will open a dropdown menu&lt;/li&gt;
&lt;li&gt;Designating an element as a &lt;a href="https://webdesign.tutsplus.com/articles/modal-and-modeless-boxes-in-web-design--webdesign-2282"&gt;modal&lt;/a&gt; with &lt;code&gt;aria-modal&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some ARIA properties establish relationships between elements. For instance, you can use &lt;code&gt;aria-describedby&lt;/code&gt; to link an element to another element that provides a longer-form description:&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;form&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"pass"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        Enter a password:
    &lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt;
        &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"pass"&lt;/span&gt;
        &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;
        &lt;span class="na"&gt;aria-describedby=&lt;/span&gt;&lt;span class="s"&gt;"pass-requirements"&lt;/span&gt;
    &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"pass-requirements"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        Your password must be at least 8 characters long.
    &lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the screenreader would announce "Your password must be at least 8 characters long" as a part of the &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; announcement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Less ARIA.
&lt;/h2&gt;

&lt;p&gt;The World Wide Web Consortium's ARIA specs provide &lt;a href="https://www.w3.org/TR/using-aria/#NOTES"&gt;five rules for ARIA use&lt;/a&gt;. The first rule isn't &lt;em&gt;quite&lt;/em&gt; "Don't use ARIA," &lt;a href="https://www.google.com/search?q=%22the+first+rule+of+aria+is+don%27t+use+aria%22"&gt;as some have quipped&lt;/a&gt;, but it's pretty close:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you &lt;em&gt;can&lt;/em&gt; use a native HTML element or attribute with the semantics and behavior you require &lt;strong&gt;already built in&lt;/strong&gt;, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, &lt;strong&gt;then do so.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In other words, ARIA should be a tool in your arsenal, but it shouldn't be the first one you reach for. Instead, your first instinct should be to use semantic elements where possible. In the case of our toggle, that might look like this, which uses a native checkbox and no ARIA at all:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/BenDMyers/embed/BayoPYV?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Why should we default to semantic markup over ARIA? Some reasons include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Semantic elements provide functionality and expose properties to the accessibility for free, out of the box. This ensures users have a robust and familiar experience across the web. With our semantic toggle, for instance, we didn't have to add tabbing or key events.&lt;/li&gt;
&lt;li&gt;Semantic markup enables &lt;a href="https://www.smashingmagazine.com/2009/04/progressive-enhancement-what-it-is-and-how-to-use-it/"&gt;progressive enhancement&lt;/a&gt;, which means your page is moderately functional, even if CSS or JavaScript resources fail. If either the CSS or the JavaScript were unable to load, our ARIA-only toggle would be toast. Our semantic toggle would at least provide a checkbox with default styles.&lt;/li&gt;
&lt;li&gt;Some assistive technologies maintain &lt;a href="https://blog.benmyers.dev/accessibility-tree/#the-ghost-of-screenreaders-past"&gt;off-screen models&lt;/a&gt; instead of consuming the accessibility tree, so these tools may not support ARIA.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I really like &lt;a href="https://noti.st/resource11/K8ARii"&gt;how Kathleen McMahon put it&lt;/a&gt;. If web development is like cooking, then semantic elements are your high-quality ingredients. ARIA attributes, then, are your seasonings. Cook with them, by all means, but you'll only need a touch.&lt;/p&gt;

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

&lt;p&gt;If you'd like to read more about ARIA, I recommend the following resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The World Wide Web Consortium's &lt;a href="https://www.w3.org/TR/wai-aria-1.1/"&gt;ARIA specs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The World Wide Web Consortium's &lt;a href="https://www.w3.org/TR/wai-aria-practices-1.1/"&gt;ARIA Authoring Practices&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Kat Shaw's &lt;a href="https://www.lullabot.com/articles/what-heck-aria-beginners-guide-aria-accessibility"&gt;What the Heck is ARIA? A Beginner's Guide to ARIA for Accessibility&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;WebAIM's &lt;a href="https://webaim.org/blog/aria-cause-solution/"&gt;To ARIA! The Cause of, and Solution to, All Our Accessibility Problems&lt;/a&gt;, by Jon Whiting&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>a11y</category>
      <category>webdev</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Surprises.</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Fri, 22 Nov 2019 17:01:18 +0000</pubDate>
      <link>https://dev.to/bendmyers/surprises-1eb3</link>
      <guid>https://dev.to/bendmyers/surprises-1eb3</guid>
      <description>&lt;p&gt;I mentor and train my employer's college hires in front-end development. At the end of the 12-week program, the college hires present what they've learned to their managers and their leads.&lt;/p&gt;

&lt;p&gt;I have one question I like to ask them, to help them prep for their demos:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"What surprised you?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I get lots of responses to this. Maybe they were surprised by collaboration tooling, or they learned how to ask questions, or they struggled with Git. All surprises, big or small, are valid here.&lt;/p&gt;

&lt;p&gt;I think this a great question to ask for self-reflection, for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;A surprise is a thing learned.&lt;/em&gt; Why did something surprise you? You had expectations that things were one way. A surprise disrupts your expectations and forces you to learn something new.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Surprises require reaction.&lt;/em&gt; Learning something is only half of the puzzle. You can learn many things and never act on them. What's the point of that? Surprises require you to adjust your status quo and adapt.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How do you use your surprises to grow and be better?&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Have you set up or been involved in an accessibility community of practice?</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Fri, 15 Nov 2019 02:28:03 +0000</pubDate>
      <link>https://dev.to/bendmyers/have-you-set-up-or-been-involved-in-an-accessibility-community-of-practice-328a</link>
      <guid>https://dev.to/bendmyers/have-you-set-up-or-been-involved-in-an-accessibility-community-of-practice-328a</guid>
      <description>&lt;p&gt;I'm embarking on a journey to set up a &lt;a href="https://wenger-trayner.com/introduction-to-communities-of-practice/"&gt;community of practice&lt;/a&gt; for accessible web and mobile development for my organization at work. Specifically, I'm trying to get representatives from seven teams together on a regular basis to discuss accessibility practices, with the ultimate goal of making each team more informed about accessibility. I've never organized anything like this, so it's very new to me.&lt;/p&gt;

&lt;p&gt;Have you set up or been involved in an accessibility community of practice, accessibility users group, or anything similiar? If so, what was your experience?&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>discuss</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Accessibility Tree</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Thu, 14 Nov 2019 04:04:14 +0000</pubDate>
      <link>https://dev.to/bendmyers/the-accessibility-tree-345</link>
      <guid>https://dev.to/bendmyers/the-accessibility-tree-345</guid>
      <description>&lt;p&gt;&lt;em&gt;You can also read this post &lt;a href="https://blog.benmyers.dev/accessibility-tree" rel="noopener noreferrer"&gt;on my blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Disabled users can and do use your page with a variety of assistive technologies. They use screenreaders, magnifiers, eye tracking, voice commands, and more. All of these assistive technologies share a common need: they all need to be able to access your page's contents.&lt;/p&gt;

&lt;p&gt;The flow of page contents from browser to assistive technology isn't often talked about, but it's a vital aspect of enabling many disabled users' access to the internet. It's taken a lot of experimentation and innovation to get to where we are now: the &lt;em&gt;accessibility tree&lt;/em&gt;. This tree shapes how disabled users understand and interact with your page, and it can mean the difference between access and exclusion. As web developers, it's our job to be aware of how the code we write shapes the tree.&lt;/p&gt;

&lt;p&gt;Let's take a journey through browser internals, operating systems, and assistive technologies. Our first stop: a crucial lesson learned from earlier screenreaders about information flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Ghost of Screenreaders Past
&lt;/h2&gt;

&lt;p&gt;The earliest screenreaders were built for text-only DOS operating systems, and they were pretty straightforward. The text was all there in the device's screen buffer, so screenreaders just needed to send the buffer's contents to speech synthesis hardware and call it a day.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;Graphical user interfaces proved trickier for screenreaders, however, since GUIs don't have any intrinsic text representations. Instead, screenreaders like Berkeley Systems' outSPOKEN had to resort to intercepting low-level graphics instructions sent to the device's graphics engine.&lt;sup&gt;2&lt;/sup&gt; Screenreaders then attempted to interpret these instructions. This rectangle with some text inside is probably a button. That text over there is highlighted, so it's probably selected. These assumptions about what was on the screen were then stored in the screenreader's own database, called an &lt;em&gt;off-screen model&lt;/em&gt;.&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdfr4hvqqfhpzl375km4p.jpg" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fdfr4hvqqfhpzl375km4p.jpg" alt="outSPOKEN menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Off-screen models posed many problems. Accounting for the alignment and placement of UI elements was tricky, and errors in calculations could snowball into bigger errors. The heuristics that off-screen models relied on could be flimsy — assuming they've even been implemented for the UI elements you want in the first place!&lt;sup&gt;3&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;Guessing at what graphics instructions mean is clearly messy, but could something like an off-screen model work for webpages? Could screenreaders scrape HTML or traverse the DOM, and insert the page contents into the model?&lt;/p&gt;

&lt;p&gt;Screenreaders such as JAWS tried this approach, but it, too, had its problems. Screenreaders and other assistive technologies usually strive to be general purpose and work no matter which application the user is running, but that's hampered by including a lot of web-parsing logic. Also, it left users high and dry whenever new HTML elements were introduced. For instance, when sites started using HTML5's new tags such as &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;, JAWS omitted key page contents until an (expensive) update could be pushed out.&lt;sup&gt;4&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;What did we learn from off-screen models? Assistive technologies that build their own off-screen models of webpages or applications can be error-prone and susceptible to new, unfamiliar elements and controls. These issues are symptoms of a bigger problem with the approach: &lt;strong&gt;when we try to reverse engineer meaning, we end up swimming upstream against the flow of information.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's go back to the drawing board. Instead of having assistive technologies make guesses about screen contents, let's have applications tell assistive technologies exactly what they're trying to convey.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessibility APIs and Building Blocks
&lt;/h2&gt;

&lt;p&gt;If you want applications such as browsers to be able to expose information to assistive technologies, you'll need them to speak the same language. Since no developer wants to have to support exposing their application's contents to each screenreader and speech recognition software and eye tracker and every other assistive technology individually, we'll need assistive technologies to share a common language. That way, those who are developing browsers or other applications need only expose their contents once and any assistive technology can use it.&lt;/p&gt;

&lt;p&gt;This &lt;em&gt;lingua franca&lt;/em&gt; is provided by the user's operating system. Specifically, operating systems have interfaces—&lt;em&gt;accessibility APIs&lt;/em&gt;—that help translate between programs and assistive technologies. These accessibility APIs have exciting names such as Microsoft Active Accessibility, IAccessible2, and macOS Accessibility Protocol.&lt;/p&gt;

&lt;p&gt;How do these accessibility APIs help? They give programs the building blocks they need to describe their contents, and they serve as a convenient middleman between a program and an assistive technology.&lt;/p&gt;

&lt;h3&gt;
  
  
  Building Blocks
&lt;/h3&gt;

&lt;p&gt;Accessibility APIs provide the building blocks for applications to describe their contents. These building blocks are data structures called &lt;em&gt;accessible objects&lt;/em&gt;. They're bundles of properties that represent the functionality of a UI element, without any of the presentational or aesthetic information.&lt;/p&gt;

&lt;p&gt;One of these building blocks could be a &lt;code&gt;Checkbox&lt;/code&gt; object, for instance.&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbrdf1qdj6un39s57q0ps.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fbrdf1qdj6un39s57q0ps.png" alt="An orange LEGO brick is labeled with properties of a Checkbox object. The name is "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You could also have a &lt;code&gt;Button&lt;/code&gt; object:&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fswc387l1zdjodgrqkdoe.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fswc387l1zdjodgrqkdoe.png" alt="A green LEGO brick is labeled with properties of a Button object. The name is "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These building blocks enable all applications to describe themselves in a similar way. As a result, a checkbox is a checkbox, as far as assistive technology is concerned, regardless of whether it appears in a Microsoft Word dialog box or on a web form.&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F705wxmauv04iu5vboms4.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F705wxmauv04iu5vboms4.png" alt="A diagram shows a pop-up with an unchecked "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These building blocks, by the way, contain three kinds of information about a UI element:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Role:&lt;/strong&gt; What kind of element is this? Is it text, a button, a checkbox, or something else? This information matters because it lays out expectations for what this element is doing here, how to interact with this element, and what will happen if you do interact with it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Name:&lt;/strong&gt; A label or identifier, called an &lt;em&gt;accessible name&lt;/em&gt;, for this element. Buttons will generally use their text contents to determine their name, so &lt;code&gt;&amp;lt;button&amp;gt;Submit&amp;lt;/button&amp;gt;&lt;/code&gt; will have the name "Submit." HTML form fields often get their name from associated &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; elements. Names are used by screenreaders to announce an element, and speech recognition users can use names in their voice commands to target specific elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;State and other properties:&lt;/strong&gt; Other functional aspects of an element that would be relevant for a user or an assistive technology to be aware of. Is this checkbox checked or unchecked? Is this expandable section currently hidden? Will clicking this button open a dropdown menu? These properties tend to be much more subject to change than an element's role or name.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see all three of these in just about any screenreader announcement:&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frufnevflhoszchrranus.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Frufnevflhoszchrranus.png" alt="VoiceOver announcement, which reads "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Accessibility APIs As a Middleman
&lt;/h3&gt;

&lt;p&gt;An application assembles these building blocks into an assistive technology-friendly representation of all of its contents. This representation is the &lt;em&gt;accessibility tree&lt;/em&gt;. The application then sends this new tree to the operating system's accessibility APIs. Assistive technologies poll the accessibility APIs regularly. They get information such as the active window, programs' contents, and the currently focused element. &lt;/p&gt;

&lt;p&gt;They can use this information in different ways. Screenreaders use this information to decide what to announce, or to enable shortcuts that allow the user to jump between different elements of the same type. Speech recognition software uses this information to determine which elements the user can target with their voice commands and how. Screen magnifiers use this information to judge where the user's cursor is, in case they need to focus elsewhere.&lt;/p&gt;

&lt;p&gt;This middleman relationship works both ways. Accessibility APIs enable assistive technologies to interact with programs, giving their users more flexibility. For instance, eye-tracking technology can interpret a user's gaze dwelling on an element as a click. The eye tracker can then send that event back through the accessibility API so that the browser treats it like a mouse click.&lt;/p&gt;

&lt;p&gt;Putting all of these pieces together, the flow of information from application to assistive technology goes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The operating system provides accessible objects for each kind of UI element.&lt;/li&gt;
&lt;li&gt;The application uses these objects as building blocks to assemble an accessibility tree.&lt;/li&gt;
&lt;li&gt;The application sends this tree to the operating system's accessibility API.&lt;/li&gt;
&lt;li&gt;Assistive technologies poll the accessibility API for updates, and receive the application's contents.&lt;/li&gt;
&lt;li&gt;The assistive technology exposes this information to the user.&lt;/li&gt;
&lt;li&gt;The assistive technology receives commands from the user, such as special hotkeys, voice commands, switch flips, or the user's gaze dwelling on an element.&lt;/li&gt;
&lt;li&gt;The assistive technology sends those commands through the accessibility API, where they're translated into interactions with the application.&lt;/li&gt;
&lt;li&gt;As the application changes, it provides a new accessibility tree to the accessibility API, and the cycle begins anew.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Or, for a much more TL;DR version:&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fkiwswwi18wq2p86ss6nh.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fkiwswwi18wq2p86ss6nh.png" alt="A diagram detailing the flow of the accessibility tree from application, through the accessibility API, to the assistive technology, and the flow of events from assistive technology, through the accessibility API, to the application."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  From the DOM to the Accessibility Tree
&lt;/h2&gt;

&lt;p&gt;We've taken a pretty sharp detour into operating system internals. Let's bring this back to the web. At this point, we can figure that your browser is, behind the scenes, converting your page's HTML elements into an accessibility tree.&lt;sup&gt;5&lt;/sup&gt; Whenever the page updates, so, too, does its accessibility tree.&lt;/p&gt;

&lt;p&gt;How do browsers know how to convert HTML elements into an accessibility tree? As with everything for the web, there's a standard for that. To that end, the World Wide Web Consortium's Web Accessibility Initiative publishes the &lt;a href="https://www.w3.org/TR/core-aam-1.1/" rel="noopener noreferrer"&gt;&lt;em&gt;Core Accessibility API Mappings&lt;/em&gt;&lt;/a&gt;, or &lt;em&gt;Core-AAM&lt;/em&gt; for short. Core-AAM provides guidance for choosing which building blocks the browser should use when. Additionally, it advises on how to calculate those blocks' properties such as their name, as well as how to manage state changes or keyboard navigation.&lt;/p&gt;

&lt;p&gt;The relationship between DOM nodes and accessibility tree nodes isn't quite one-to-one. Some nodes might be flattened, such as &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s or &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s that are only being used for styling. Other elements, such as &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; elements, might be expanded into several nodes of the accessibility tree. This is because video players are complex, and need to expose several controls like the &lt;em&gt;Play/Pause&lt;/em&gt; button, the progress bar, and the &lt;em&gt;Full Screen&lt;/em&gt; button.&lt;sup&gt;6&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;Some browsers let you view the accessibility tree in their developer tools. Try it now! If you're using Chrome, right-click on a page element and click &lt;em&gt;Inspect&lt;/em&gt;. In the pane that opened up with tabs such as &lt;em&gt;Styles&lt;/em&gt; and &lt;em&gt;Computed&lt;/em&gt;, click the &lt;em&gt;Accessibility&lt;/em&gt; tab. This might be hidden. Congrats! You can now see that element in the accessibility tree! If you're using other browsers, you can instead follow &lt;a href="https://developer.mozilla.org/en-US/docs/Tools/Accessibility_inspector" rel="noopener noreferrer"&gt;Firefox's Accessibility Inspector instructions&lt;/a&gt; or &lt;a href="https://docs.microsoft.com/en-us/microsoft-edge/devtools-guide/elements/accessibility" rel="noopener noreferrer"&gt;Microsoft Edge's instructions.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Poke around on different sites and see what kinds of nodes you can find and which properties they have.&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwt3oy2dbkr1mrcs6gilk.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fwt3oy2dbkr1mrcs6gilk.png" alt="Facebook's homepage's accessibility tree, as viewed in the Chrome Developer Tools"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  But Why Do We Care?
&lt;/h2&gt;

&lt;p&gt;Why should web developers care about the accessibility tree? Is it any more than just some interesting trivia about browser internals?&lt;/p&gt;

&lt;p&gt;Understanding the flow of a webpage's contents from browser to assistive technology changed the way I view the web apps I work on. I think there are three key ways that this flow impacts web developers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It explains discrepancies between different assistive technologies on different platforms.&lt;/li&gt;
&lt;li&gt;Browsers can use accessibility trees to optimize how pages are exposed to assistive technologies.&lt;/li&gt;
&lt;li&gt;Web developers have a responsibility to be good stewards of the accessibility tree.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Explaining Discrepancies
&lt;/h3&gt;

&lt;p&gt;We know that there are three key players in the flow of web contents to assistive technologies: the browser, the operating system accessibility API, and the assistive technology itself. This gives us three possible places to introduce discrepancies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Operating system accessibility APIs could provide different building blocks.&lt;/li&gt;
&lt;li&gt;Browsers could use assemble their accessibility trees differently.&lt;/li&gt;
&lt;li&gt;Assistive technologies could interpret those building blocks in different ways.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These differences are, honestly, minute most of the time. However, bugs that affect certain combinations of browsers and assistive technologies are prevalent enough that you should be testing your sites on many different combinations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Browser Optimizations
&lt;/h3&gt;

&lt;p&gt;When constructing accessibility trees, many browsers employ heuristics to improve the user experience. For instance, many developers use the CSS rules &lt;code&gt;display: none;&lt;/code&gt; or &lt;code&gt;visibility: hidden;&lt;/code&gt; to remove content from the page. However, since the content is still in the HTML, those using assistive technologies would still be able to get to it, which could have undesirable consequences. Browsers instead use these CSS rules as flags that they should remove those elements from the accessibility tree, too. This is why we have to resort to &lt;a href="https://cloudfour.com/thinks/see-no-evil-hidden-content-and-accessibility/#showing-additional-content-for-screen-readers" rel="noopener noreferrer"&gt;other tricks to create screenreader-only text.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, browsers use tricks to protect users from developers' bad habits. For instance, to counter the &lt;a href="https://webaim.org/techniques/tables/" rel="noopener noreferrer"&gt;problems that can be caused by layout tables&lt;/a&gt;, both Google Chrome&lt;sup&gt;7&lt;/sup&gt; and Mozilla Firefox&lt;sup&gt;8&lt;/sup&gt; will guess at whether a &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; element is being used for layout or for tabular data and adjust the accessibility tree accordingly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tree Stewardship
&lt;/h3&gt;

&lt;p&gt;Being aware of the accessibility tree and how it impacts your users' experience should make one thing clear: to build quality web applications, we must be responsible stewards of our applications' accessibility trees. After all, it's the only way many assistive technology users will be able to navigate and interface with our page. If our tree is rotten, there's not really anything these users can do to make our page usable. Fortunately, we have two tools for tree stewardship at our disposal: semantic markup and ARIA.&lt;/p&gt;

&lt;p&gt;When we use semantic markup, we make it much, much easier for browsers to determine the most appropriate building blocks. When we write &lt;code&gt;&amp;lt;input type="checkbox" /&amp;gt;&lt;/code&gt;, for instance, the browser knows it can put a &lt;code&gt;Checkbox&lt;/code&gt; object in the tree with all of the properties that that entails. The browser can trust that that's an accurate representation of the UI element. The same goes for buttons and any other kind of UI element you might want on your page. &lt;/p&gt;

&lt;p&gt;Semantic markup will work for the majority of our needs, but there are times when we need to make tweaks here and there to our application's accessibility tree. This is what ARIA is for! In my next post, I'll explore how ARIA's whole purpose is to modify elements' representation in the accessibility tree.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Decades of trial and error in building screenreaders and a wide variety of other assistive technologies have taught us one big lesson: assistive technology will work much more reliably when information flows directly to it rather than be reverse engineered. Browsers do a lot of heavy lifting to make sure our pages play nicely with assistive technologies. However, they can't do their job well if we don't do our job well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Footnotes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Please forgive the oversimplification.&lt;/li&gt;
&lt;li&gt;Rich Schwerdtfeger, &lt;em&gt;BYTE&lt;/em&gt;, &lt;a href="https://developer.paciellogroup.com/blog/2015/01/making-the-gui-talk-1991-by-rich-schwerdtfeger/" rel="noopener noreferrer"&gt;Making the GUI Talk&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Léonie Watson &amp;amp; Chaals McCathie Nevile, &lt;em&gt;Smashing Magazine&lt;/em&gt;, &lt;a href="https://www.smashingmagazine.com/2015/03/web-accessibility-with-accessibility-api/" rel="noopener noreferrer"&gt;Accessibility APIs: A Key To Web Accessibility&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Marco Zehe, &lt;a href="https://marcozehe.wordpress.com/2013/09/07/why-accessibility-apis-matter/" rel="noopener noreferrer"&gt;Why accessibility APIs matter&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;It probably comes as no surprise that the accessibility tree is built in parallel to the DOM. One of the things I realized as I was writing this post is that creating structured representations of a page that enable programmatic interfacing with the page is really browsers' bread and butter. Your browser does exactly this to manage page contents (via the DOM) and element styles (via the CSS Object Model), so why not throw in accessibility tree creation while you're at it?&lt;/li&gt;
&lt;li&gt;Steve Faulkner, The Paciello Group, &lt;a href="https://developer.paciellogroup.com/blog/2015/01/the-browser-accessibility-tree/" rel="noopener noreferrer"&gt;The Browser Accessibility Tree&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chromium.googlesource.com/chromium/blink/+/master/Source/modules/accessibility/AXTable.cpp" rel="noopener noreferrer"&gt;Chromium source code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dxr.mozilla.org/mozilla-central/source/accessible/generic/TableAccessible.cpp" rel="noopener noreferrer"&gt;Firefox source code&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>webdev</category>
      <category>a11y</category>
    </item>
    <item>
      <title>How Domino's Could Topple the Accessible Web – Part 1: Public Accommodations</title>
      <dc:creator>Ben Myers</dc:creator>
      <pubDate>Sat, 07 Sep 2019 13:54:27 +0000</pubDate>
      <link>https://dev.to/bendmyers/how-domino-s-could-topple-the-accessible-web-part-1-public-accommodations-29pp</link>
      <guid>https://dev.to/bendmyers/how-domino-s-could-topple-the-accessible-web-part-1-public-accommodations-29pp</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is the first in a three-part series on web accessibility in American case law, and the impact Robles v. Domino's Pizza could have on that landscape. This first entry focuses on the ways courts interpret public accommodations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can also read this post &lt;a href="https://blog.benmyers.dev/dominos-1/"&gt;on my blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Happening
&lt;/h2&gt;

&lt;p&gt;Last year, 2,285 web accessibility cases were filed in the US. That's about six cases a day, and it's almost three times as many cases as 2017.^1 As the number of cases rises, so too does the media attention, and no case has quite stolen that spotlight like Robles v. Domino's Pizza has.&lt;/p&gt;

&lt;p&gt;Guillermo Robles has had a storied three years. As a blind man who navigates the web using a screenreader, he found he was unable to order pizza from Domino's. He filed a suit against Domino's in September 2016, alleging that Domino's website and mobile app were incompatible with his screenreader. The Central District of California dismissed the case on the grounds that the law was not concrete enough to hold Domino's accountable. The Ninth Circuit Court of Appeals overturned that dismissal in January 2019, asserting that the law does, in fact, hold the pizza chain accountable for inaccessible websites and apps. Most recently, in July, Domino's petitioned to bring the case to the Supreme Court. They're backed by the U.S. Chamber of Commerce, the Restaurant Law Center, and the National Retail Federation.^2 Businesses really, really want to see this case go their way.&lt;/p&gt;

&lt;p&gt;This case could have a lasting impact for many disabled users of the internet. The Supreme Court has not yet seen a web accessibility case, meaning lower courts have been left to figure this out for themselves. Specifically, courts have been grappling with two big questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Does American law require websites to be accessible?&lt;/li&gt;
&lt;li&gt;If so, which standards of accessibility are websites held to?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The courts' many responses to those questions have led to a lot of confusion, ambiguity, and frustration. However, understanding where these courts are coming from is vital to understanding the future of disabled users' access to the internet.&lt;/p&gt;

&lt;p&gt;Let's look at that first question:&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the Law Require Web Accessibility?
&lt;/h2&gt;

&lt;p&gt;No federal law mentions web accessibility. As a result, courts turn to the next best thing: the Americans with Disabilities Act. &lt;a href="https://www.ada.gov/pubs/adastatute08.htm#SubchapIII"&gt;Title III of the ADA&lt;/a&gt; forbids public accommodations from discriminating against disabled Americans:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"No individual shall be discriminated against on the basis of disability in the full and equal enjoyment of the goods, services, facilities, privileges, advantages, or accommodations of any place of public accommodation by any person who owns, leases (or leases to), or operates a place of public accommodation."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Disabled plaintiffs argue that websites count as public accommodations and, as a result, cannot be inaccessible.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Public Accommodation?
&lt;/h3&gt;

&lt;p&gt;It's here that a definition of "public accommodation" would be really nice. Title III, however, does not provide one. Instead, it offers &lt;a href="https://www.ada.gov/pubs/adastatute08.htm#12181"&gt;a long list of examples of public accommodations&lt;/a&gt;, including hotels, restaurants, banks, travel services, zoos, laundromats, and many more. This list is well understood to be nonexhaustive.^3 Crucially, however, it does not mention websites.&lt;/p&gt;

&lt;h3&gt;
  
  
  So, Are Websites Public Accommodations?
&lt;/h3&gt;

&lt;p&gt;Courts are divided on this question, but their opinions can be roughly grouped into three categories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Yes, websites are public accommodations.&lt;/li&gt;
&lt;li&gt;No, websites are not public accommodations.&lt;/li&gt;
&lt;li&gt;Websites are &lt;em&gt;sometimes&lt;/em&gt; public accommodations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These opinions conflict a lot, meaning there are many cases with inconsistent rulings.&lt;/p&gt;




&lt;h4&gt;
  
  
  Opinion #1: Yes, Websites Are Public Accommodations
&lt;/h4&gt;

&lt;p&gt;Amongst courts, the opinion that websites are inherently public accommodations is the most fringe. These courts, namely the First and Seventh Circuit Courts of Appeals, maintain that websites are public accommodations just by virtue of providing a service.&lt;/p&gt;

&lt;p&gt;The courts argue that there is precedent for nonphysical spaces counting as public accommodations. They wipe the dust off an old case, ADA-wise: the Carparts Distribution Center, Inc. v. Automotive Wholesaler's Association of New England case from 1994. In Carparts, the First Circuit ruled that the ADA covered phone-based services. They noted that Congress had included travel services in the list of example public accommodations. At the time, the travel services industry was largely telephone-based, so the First Circuit reasoned that &lt;em&gt;obviously&lt;/em&gt; Congress intended to include nonphysical spaces such as telephone lines.&lt;/p&gt;

&lt;p&gt;In their Carparts ruling, the First Circuit noted that:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"It would be irrational to conclude that persons who enter an office to purchase services are protected by the ADA, but persons who purchase the same services over the telephone or by mail are not. Congress could not have intended such an absurd result."&lt;/p&gt;

&lt;p&gt;—First Circuit Court of Appeals, &lt;a href="https://scholar.google.com/scholar_case?case=3450944898673982089"&gt;Carparts Distribution Ctr. v. Automotive Wholesaler's Ass'n.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Seventh Circuit court has applied this reasoning to an insurance company that sold its services online:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The defendant asks us to interpret 'public accommodation' literally, as denoting a physical site, such as a store or a hotel, but we have already rejected that interpretation. An insurance company can no more refuse to sell a policy to a disabled person over the Internet than a furniture store can refuse to sell furniture to a disabled person who enters the store."&lt;/p&gt;

&lt;p&gt;—Seventh Circuit Court of Appeals, &lt;a href="https://scholar.google.com/scholar_case?case=731343607554833896"&gt;Morgan v. Joint Admin. Bd.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://scholar.google.com/scholar_case?case=15520314324288957354"&gt;Netflix&lt;/a&gt;, &lt;a href="https://scholar.google.com/scholar_case?case=8523925640371825721"&gt;Scribd&lt;/a&gt;, and &lt;a href="http://www.nhd.uscourts.gov/sites/default/files/opinions/17/17NH236.pdf"&gt;Blue Apron&lt;/a&gt; have all found themselves at the receiving end of courts of this opinion.&lt;/p&gt;




&lt;h4&gt;
  
  
  Opinion #2: No, Websites Are Not Public Accommodations
&lt;/h4&gt;

&lt;p&gt;If the First Circuit's Carparts ruling seems like a bit of a stretch to you, you're not alone.&lt;/p&gt;

&lt;p&gt;Courts of this opinion, such as the Third, Fifth, and Sixth Circuit Courts, point to the ADA's full wording: "&lt;strong&gt;place&lt;/strong&gt; of public accommodation." Nonphysical spaces such as websites, they argue, aren't places, and therefore they aren't covered by Title III. To claim that they are covered would be to vastly expand the scope of the law:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Here, to fall within the scope of the ADA as presently drafted, a public accommodation must be a physical, concrete structure. To expand the ADA to cover 'virtual' spaces would be to create new rights without well-defined standards."&lt;/p&gt;

&lt;p&gt;—District Court for the Southern District of Florida, &lt;a href="https://scholar.google.com/scholar_case?case=9596654457159505828"&gt;Access Now, Inc. v. Southwest Airlines, Co.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Full disclosure: the Southern District of Florida actually sided with Opinion #3 in the Southwest Airlines case. This line just happens to be a very succinct explanation of Opinion #2.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These courts often explicitly reject the Carparts ruling as an overreach:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"In arriving at this conclusion, the First Circuit disregarded the statutory canon of construction, noscitur a sociis. [...] The doctrine of noscitur a sociis instructs that 'a ... term is interpreted within the context of the accompanying words 'to avoid the giving of unintended breadth to the Acts of Congress.'' [...] The clear connotation of the words in §12181(7) [the list of examples of public accommodations] is that a public accommodation is a physical place. Every term listed in §12181(7) and subsection (F) is a physical place open to public access."&lt;/p&gt;

&lt;p&gt;—Sixth Circuit Court of Appeals, &lt;a href="https://scholar.google.com/scholar_case?case=2618241798638496180"&gt;Parker v. Metropolitan Life Ins. Co.&lt;/a&gt;, citations omitted&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Other cases that have made similar arguments and have been used as precedents within these courts include &lt;a href="https://scholar.google.com/scholar_case?case=11431374417764636751"&gt;Ford v. Schering-Plough Corp.&lt;/a&gt; and &lt;a href="https://scholar.google.com/scholar_case?case=16043862805835728767"&gt;Weyer v. Twentieth Century Fox Film Corp.&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Additionally, the ADA has been amended several times since the rise of the internet. If Congress really did intend for the ADA to cover nonphysical spaces such as websites, surely they would have included that in one of the amendments, right?^4&lt;/p&gt;




&lt;h4&gt;
  
  
  Opinion #3: Websites Are &lt;em&gt;Sometimes&lt;/em&gt; Public Accommodations
&lt;/h4&gt;

&lt;p&gt;The most frequent court opinion about websites as public accommodations kind of sidesteps the question altogether by claiming that websites can be &lt;em&gt;extensions&lt;/em&gt; of public accommodations.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"While there is some disagreement amongst district courts on this question, it appears that the majority of courts agree that websites are not covered by the ADA unless some function on the website hinders the full use and enjoyment of a physical space."&lt;/p&gt;

&lt;p&gt;—District Court for the Southern District of Florida, &lt;a href="https://www.devinemillimet.com/getmedia/e026ae60-63c1-4895-abe8-42c5826d42fa/Gomez-v-Bang-Olufsen-Am-_-Inc-_-2017-U-S-Dist-LEXI.pdf"&gt;Gomez v. Bang &amp;amp; Olufsen Am., Inc.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the principle of nexus: if a website has a significant connection to the goods and services offered by a physical public accommodation, then the website is seen as an extension of the public accommodation. In that case, it would be subject to Title III. After all, Title III forbids obstructing access to the goods and services "&lt;strong&gt;of&lt;/strong&gt; any place of public accommodation," not "&lt;strong&gt;in&lt;/strong&gt; any place of public accommodation."&lt;/p&gt;

&lt;p&gt;The first federal trial on web accessibility to be carried out in full was &lt;a href="https://scholar.google.com/scholar_case?case=6744502269111605689"&gt;Gil v. Winn-Dixie&lt;/a&gt; in 2017. Winn-Dixie offered digital coupons on their website that were only redeemable in their brick-and-mortar stores. Additionally, Winn-Dixie gave customers the option to refill their prescriptions online, but the refills also had to be picked up in-store. The Southern District of Florida determined that the Winn-Dixie website therefore had a nexus to the brick-and-mortar franchises. Thus, the website's incompatibility with screenreaders was a violation of the ADA.^5&lt;/p&gt;

&lt;p&gt;Nexus does go the other way. In &lt;a href="https://scholar.google.com/scholar_case?case=13814511373260202940"&gt;Earll v. eBay, Inc.&lt;/a&gt;, for instance, a deaf plaintiff sued eBay since she couldn't use the site's phone-based vendor verification service. The Ninth Circuit determined that, since eBay doesn't have any consumer-facing, brick-and-mortar locations, eBay is not a public accommodation and is not subject to Title III.^6 &lt;a href="https://scholar.google.com/scholar_case?case=627192113961347360"&gt;Netflix&lt;/a&gt;, &lt;a href="https://scholar.google.com/scholar_case?case=3753744983787595468"&gt;Viacom&lt;/a&gt;, &lt;a href="https://scholar.google.com/scholar_case?case=14196698777849520612"&gt;Facebook&lt;/a&gt;, and &lt;a href="https://scholar.google.com/scholar_case?case=9596654457159505828"&gt;Southwest Airlines&lt;/a&gt; have also been defended with a similar argument.&lt;/p&gt;

&lt;p&gt;Much like it did during the Winn-Dixie case, the Ninth Circuit applied the nexus argument to Domino's this January when overturning the district court's dismissal of Robles's case:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Domino's website and app facilitate access to the goods and services of a place of public accommodation — Domino's physical restaurants. They are two of the primary (and heavily advertised) means of ordering Domino's products to be picked up at or delivered from Domino's restaurants. We agree with the district court in this case — and the many other district courts that have confronted this issue in similar contexts — that the ADA applies to Domino's website and app, which connect customers to the goods and services of Domino's physical restaurants."&lt;/p&gt;

&lt;p&gt;—Ninth Circuit Court of Appeals, &lt;a href="https://scholar.google.com/scholar_case?case=14468696865090361672&amp;amp;hl=en&amp;amp;as_sdt=6,44#p905"&gt;Robles v. Domino's Pizza&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;p&gt;The Robles v. Domino's Pizza case is just one of many court cases centered around whether American law requires websites to be accessible. The number of web accessibility-related lawsuits is only going to go up from here as courts continue to give mixed opinions on the matter.&lt;/p&gt;

&lt;p&gt;By appealing the Ninth Circuit's decision, Domino’s Pizza is giving the Supreme Court the opportunity to affirm, finally, whether websites are inherently public accommodations, whether they're inherently &lt;em&gt;not&lt;/em&gt; public accommodations, or whether they count as public accommodations if a nexus is present.&lt;/p&gt;

&lt;p&gt;However, while the question of whether the ADA covers websites is important, it's not the only question Domino's is contesting. Stick around for Part 2, where we'll cover magic checklists and due process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Footnotes
&lt;/h2&gt;

&lt;p&gt;^1 The National Law Review, &lt;a href="https://www.natlawreview.com/article/when-good-sites-go-bad-growing-risk-website-accessibility-litigation"&gt;When Good Sites Go Bad: The Growing Risk of Website Accessibility Litigation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;^2 The Washington Post, &lt;a href="https://www.washingtonpost.com/politics/courts_law/do-protections-for-people-with-disabilities-apply-online-dominos-asks-high-court/2019/07/20/984c685e-a7fd-11e9-a3a6-ab670962db05_story.html"&gt;Do protections for people with disabilities apply online? Domino’s asks high court.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;^3 That is, to an extent. The twelve subcategories listed are pretty fixed, but enough of the subcategories include "or other X" clauses that this list is pretty open to interpretation.&lt;/p&gt;

&lt;p&gt;^4 District Court for the Eastern District of Virginia, &lt;a href="https://news.cuna.org/ext/resources/NewsNow/2018/2018/January/Carroll-v-Northwest-Fed-CU---17cv1205---Order.pdf"&gt;Carroll v. Northwest Federal Credit Union&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;^5 District Court for the Southern District of Florida, &lt;a href="https://scholar.google.com/scholar_case?case=6744502269111605689"&gt;Gil v. Winn-Dixie&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;^6 Ninth Circuit Court of Appeals, &lt;a href="https://scholar.google.com/scholar_case?case=13814511373260202940"&gt;Earll v. eBay, Inc.&lt;/a&gt;&lt;/p&gt;

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