<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Accessibility on Retro Dispatch</title><link>https://phantompixeldev.github.io/hugo-theme-retrocss/categories/accessibility/</link><description>Recent content in Accessibility on Retro Dispatch</description><generator>Hugo</generator><language>en-us</language><copyright>© 2026 Retro Dispatch</copyright><lastBuildDate>Fri, 21 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://phantompixeldev.github.io/hugo-theme-retrocss/categories/accessibility/index.xml" rel="self" type="application/rss+xml"/><item><title>Why your div is not a button</title><link>https://phantompixeldev.github.io/hugo-theme-retrocss/posts/why-your-div-is-not-a-button/</link><pubDate>Fri, 21 Aug 2026 00:00:00 +0000</pubDate><guid>https://phantompixeldev.github.io/hugo-theme-retrocss/posts/why-your-div-is-not-a-button/</guid><description>&lt;p&gt;A &lt;code&gt;div&lt;/code&gt; with a click handler looks like a button and behaves like nothing.&lt;/p&gt;
&lt;h2 id="what-you-lose"&gt;
 What you lose
 &lt;a class="heading-anchor" href="#what-you-lose" aria-label="Link to What you lose"&gt;&lt;span aria-hidden="true"&gt;#&lt;/span&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Tab order. Enter and Space. The implicit &lt;code&gt;button&lt;/code&gt; role. The disabled state.
Form submission. Focus visibility. Every one of those is a line of code you now
own, and a line you will forget on the next component.&lt;/p&gt;
&lt;h2 id="what-it-costs-to-get-back"&gt;
 What it costs to get back
 &lt;a class="heading-anchor" href="#what-it-costs-to-get-back" aria-label="Link to What it costs to get back"&gt;&lt;span aria-hidden="true"&gt;#&lt;/span&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma retro-code"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;button&amp;#34;&lt;/span&gt; &lt;span class="na"&gt;tabindex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;0&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="na"&gt;onkeydown&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;if (event.key === &amp;#39;Enter&amp;#39; || event.key === &amp;#39; &amp;#39;) this.click()&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Save
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That is the &lt;em&gt;minimum&lt;/em&gt;, and it still does not report a disabled state, still does
not submit a form, and still needs &lt;code&gt;event.preventDefault()&lt;/code&gt; so Space does not
scroll the page.&lt;/p&gt;</description></item></channel></rss>