<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: patrick clancey</title>
    <description>The latest articles on Forem by patrick clancey (@patrick_clancey).</description>
    <link>https://forem.com/patrick_clancey</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%2F1694427%2F715e0ef2-0f95-4363-80c1-76b8d91fa34e.jpg</url>
      <title>Forem: patrick clancey</title>
      <link>https://forem.com/patrick_clancey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/patrick_clancey"/>
    <language>en</language>
    <item>
      <title>Unlocking Hidden Content: An Introduction to hidden='until-found'</title>
      <dc:creator>patrick clancey</dc:creator>
      <pubDate>Wed, 10 Sep 2025 11:00:36 +0000</pubDate>
      <link>https://forem.com/patrick_clancey/unlocking-hidden-content-an-introduction-to-hiddenuntil-found-1mpa</link>
      <guid>https://forem.com/patrick_clancey/unlocking-hidden-content-an-introduction-to-hiddenuntil-found-1mpa</guid>
      <description>&lt;p&gt;The value &lt;code&gt;'until-found'&lt;/code&gt; for the &lt;code&gt;hidden&lt;/code&gt; HTML attribute is supported by Chrome and Firefox at the time of writing. Also, support has been added to Safari TP and is expected to land this year.&lt;/p&gt;

&lt;p&gt;Before we look at the &lt;code&gt;'until-found'&lt;/code&gt; value specifically, let's quickly recap what the &lt;code&gt;hidden&lt;/code&gt; attribute does when it's added to an HTML element. This attribute tells the browser that the element's contents are not currently relevant and should not be presented to the user. Commonly, the browser will then apply the CSS style &lt;code&gt;display: none&lt;/code&gt;, totally hiding the element. In contrast, when &lt;code&gt;hidden='until-found'&lt;/code&gt; is applied, this tells the browser that the contents are relevant, but should not be visible initially.  Despite being visually hidden, its content remains discoverable by the browser (although not in the DOM and not in the accessibility tree). So, the browser's "Find in Page" and deep linking functionality will still work.&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;div&lt;/span&gt; &lt;span class="na"&gt;hidden&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hello, I'm totally hidden and cannot be found.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;hidden=&lt;/span&gt;&lt;span class="s"&gt;"until-found"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Hello, I'm invisible, but can still be found!&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a user searches for and finds text within such an element, the browser automatically reveals it and scrolls it into view. This feature improves initial page load times by deferring content rendering while maintaining a seamless search experience. It's ideal for progressively disclosing content like collapsible sections that users might search for.&lt;/p&gt;

&lt;p&gt;In a nutshell, content within an element that has the hidden attribute (or CSS &lt;code&gt;display: none&lt;/code&gt;) will not be found by the browser and cannot be deep linked to. Whereas content within an element with &lt;code&gt;hidden='until-found'&lt;/code&gt; is discoverable and can be linked to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interactive Components
&lt;/h2&gt;

&lt;p&gt;Hidden content is a fundamental feature of interactive components such as accordions, carousels, and tabbed interfaces. These popular UI patterns offer several advantages including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Space Optimisation&lt;/strong&gt;: Simply stacking all content vertically can lead to extremely long, overwhelming pages that require excessive scrolling, making them hard to navigate and boring. These components allow you to condense content by showing only a portion of it at a time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Well-Structured Content&lt;/strong&gt;: Monolithic blocks of text or images can be difficult for users to scan, understand, and navigate. Key information might get lost. Grouping related information into a collapsible section helps provide a clear, logical structure for content, making it easier for users to find what they're looking for.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enhanced User Experience&lt;/strong&gt;: Long, static pages can be boring and increase cognitive load, which can lead to user fatigue or abandonment. Interactive components and progressive disclosure make the page feel more dynamic, less daunting, and quite frankly, more 'fun'.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aesthetic Appeal&lt;/strong&gt;: These components contribute to a cleaner aesthetic. They can make a page look less cluttered and more professional.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  The Problem
&lt;/h1&gt;

&lt;p&gt;Let's take a look at what problems &lt;code&gt;hidden='until-found'&lt;/code&gt; solves. &lt;/p&gt;

&lt;p&gt;Despite the benefits of interactive components, traditional hidden content presents a significant accessibility challenge, it's simply not discoverable by browsers.&lt;/p&gt;

&lt;p&gt;This invisibility creates a disproportionate burden for several user groups. For example, visually impaired users, who often rely on screen readers and the browser's "Find in Page" functionality, are particularly affected. &lt;/p&gt;

&lt;p&gt;Similarly, users with motor control issues face additional obstacles when navigating interactive components that hide content.&lt;/p&gt;

&lt;p&gt;When content is hidden using conventional methods, search functions cannot locate relevant information severely limiting these users' ability to find what they need.&lt;/p&gt;

&lt;p&gt;These limitations create a fundamental tension: the very components designed to improve user experience for some can simultaneously erect barriers for others. This is precisely the problem that &lt;code&gt;hidden='until-found'&lt;/code&gt; was designed to solve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation Example
&lt;/h2&gt;

&lt;p&gt;In the following tabbed component example, which is implemented using &lt;code&gt;hidden='until-found'&lt;/code&gt;, we can see how content becomes both searchable and linkable.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Developer notes
&lt;/h2&gt;

&lt;p&gt;In the above example, instead of using a classname (commonly using the CSS &lt;code&gt;display: none&lt;/code&gt; property), we are using the &lt;code&gt;hidden='until-found'&lt;/code&gt; attribute. When content is 'found' by the browser, it dispatches a JavaScript event called &lt;code&gt;beforematch&lt;/code&gt;, and the content is shown. In the case of a tab component, we can't have two tabs visible at the same time, so we listen for the &lt;code&gt;beforematch&lt;/code&gt; event, and when it fires, we need to manually hide whichever tab is not required.&lt;/p&gt;

&lt;p&gt;There is one obvious difference between &lt;code&gt;hidden&lt;/code&gt; and &lt;code&gt;hidden='until-found'&lt;/code&gt; any block-level styles on the element like border or padding won't be visible when the &lt;code&gt;hidden&lt;/code&gt; attribute is used, but WILL be when &lt;code&gt;hidden='until-found'&lt;/code&gt; is applied. This is because the browser will typically only hide the element's contents and not the element itself. Not a big deal, but still something to bear in mind if you are going to be working with an existing codebase.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://caniuse.com/?search=hidden%3Duntil-found" rel="noopener noreferrer"&gt;Can I Use | hidden until-found&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.chrome.com/docs/css-ui/hidden-until-found" rel="noopener noreferrer"&gt;Making collapsed content accessible with hidden=until-found&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/hidden" rel="noopener noreferrer"&gt;HTML hidden global attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://css-tricks.com/covering-hiddenuntil-found/" rel="noopener noreferrer"&gt;Covering hidden=until-found&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://drafts.csswg.org/css-pseudo-4/#selectordef-search-text" rel="noopener noreferrer"&gt;CSS Pseudo-Elements Module Level 4 ::search-text selector&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>html</category>
      <category>wcag</category>
      <category>a11y</category>
      <category>css</category>
    </item>
    <item>
      <title>WCAG: Empty Links</title>
      <dc:creator>patrick clancey</dc:creator>
      <pubDate>Thu, 17 Apr 2025 11:40:53 +0000</pubDate>
      <link>https://forem.com/patrick_clancey/wcag-empty-links-4e86</link>
      <guid>https://forem.com/patrick_clancey/wcag-empty-links-4e86</guid>
      <description>&lt;p&gt;The European Union has implemented new accessibility regulations with a compliance deadline of June 28th, 2025. Many companies are proactively taking steps to meet these standards to avoid penalties and ensure their digital platforms are accessible to all users.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.eumonitor.eu/9353000/1/j9vvik7m1c3gyxp/vkz686pm8ozr" rel="noopener noreferrer"&gt;The European Accessibility Act (EAA) - Directive 2019/882&lt;/a&gt;, which establishes a comprehensive set of accessibility rules for digital offerings within the EU market, is going to come into effect next year. The deadline for compliance with this new legislation is June 28th, 2025. WCAG 2 Level AA is widely recognised as a benchmark for achieving EAA compliance.&lt;/p&gt;

&lt;p&gt;With this in mind, I'm taking a look at some of the most common accessibility issues according to The &lt;a href="https://webaim.org/projects/million/" rel="noopener noreferrer"&gt;WebAIM 2024 report on the accessibility of the top 1,000,000 home pages&lt;/a&gt;, who they affect, and how to fix them.&lt;/p&gt;

&lt;p&gt;In this post, I'll explore empty links — their impact, who they affect, and how to fix them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why empty links matter
&lt;/h2&gt;

&lt;p&gt;Firstly, let's take a quick look at a couple of fairly typical examples.&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="c"&gt;&amp;lt;!-- Links with graphics with no alt --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/doberman.png"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- Links icons content with no text content --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://bsky.app/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"icon icon--bluesky"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Links containing icons, images without alt text or simply empty lead to confusion for users of assistive technologies. &lt;a href="https://webaim.org/projects/million/" rel="noopener noreferrer"&gt;WebAIM 2024 report on the accessibility of the top 1,000,000 home pages&lt;/a&gt; found that almost half of the pages tested contained empty links (or buttons). &lt;/p&gt;

&lt;p&gt;The lack of any text label on these controls means that assistive technologies can't determine where links go.&lt;/p&gt;

&lt;p&gt;To add an accessible text to the link there are a couple of options&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="c"&gt;&amp;lt;!-- use alt text --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Canine hip dysplasia"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"/doberman.png"&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- use an aria label --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://bsky.app/"&lt;/span&gt; &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Bluesky"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"icon icon--bluesky"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- use a visually hidden text --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://bsky.app/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;aria-hidden=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"icon icon--bluesky"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"visually-hidden"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Bluesky&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(for visually-hidden example see &lt;a href="https://getbootstrap.com/docs/5.0/helpers/visually-hidden/" rel="noopener noreferrer"&gt;bootstrap visually-hidden helper&lt;/a&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is impacted by missing link text?
&lt;/h2&gt;

&lt;p&gt;Missing link text creates significant barriers for several groups of web users. &lt;/p&gt;

&lt;p&gt;For example; it affects people who are blind or have severe visual impairments who rely on screen readers. When these users encounter a link without text, their screen reader simply announces "link" without any context about where it leads.&lt;/p&gt;

&lt;p&gt;Voice control users, such as people with motor disabilities or temporary injuries, also struggle significantly. They need to be able to say the name of a link to click it, but they can't activate a link that has no name.&lt;/p&gt;

&lt;p&gt;Users with cognitive disabilities also find unnamed links particularly challenging. They need clear, consistent navigation to make sense of websites, and unlabelled links create unnecessary mental work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related WCAG guidelines
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context" rel="noopener noreferrer"&gt;2.4.4 Link Purpose (In Context)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/name-role-value" rel="noopener noreferrer"&gt;4.1.2 Name, Role, Value&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Other related issue
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Alt text doesn't describe the link target
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- 
    A link with graphic where the alt describes 
    the image not the link target 
--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Doberman dog asleep in a wicker basket"&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the alt text should describe the link target not the image itself. e.g.&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;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Canine hip dysplasia"&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Duplicate adjacent links
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- 
    A link which duplicates an adjacent link, 
    for example so users navigating with a 
    pointer can click on the image 
--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Canine hip dysplasia"&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   Canine hip dysplasia
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case the links should be combined so there is only one link. And the image should not have an alt value.&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;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   Canine hip dysplasia
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In some rare cases, where you are providing links for pointer users and you can't combine the links, you may have to resort to removing the duplicate form the accessibility tree.&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;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt; 
    &lt;span class="na"&gt;tabindex=&lt;/span&gt;&lt;span class="s"&gt;"-1"&lt;/span&gt; 
    &lt;span class="na"&gt;aria-hidden=&lt;/span&gt;&lt;span class="s"&gt;"true"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   Canine hip dysplasia
&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this technique pointer users can click on the image and keyboard users don't have to tab though duplicate links. &lt;/p&gt;

&lt;h3&gt;
  
  
  Links out of context
&lt;/h3&gt;

&lt;p&gt;Links that lack context e.g. "Read more".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
  Canine hip dysplasia is one of the most 
  common musculoskeletal conditions that 
  affect our canine companions
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   Read more
  &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To add context we can use visually hidden text or aria-label. For example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
  Canine hip dysplasia is one of the most 
  common musculoskeletal conditions that 
  affect our canine companions
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/Canine_hip_dysplasia"&lt;/span&gt; 
    &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Canine hip dysplasia. Read more"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    Read more
  &lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adding context is important for screen reader users as they often navigate by listing all the links on a page. If all they hear is "read more, read more, read more," they have no idea where each link leads. They lack the visual context that sighted users have.&lt;/p&gt;

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

&lt;p&gt;All links having accessible text ensures everyone, including screen reader users and those with cognitive disabilities, can understand the link's purpose and destination, leading to improved navigation and a better user experience.&lt;/p&gt;

&lt;p&gt;Providing accessible link text is generally easy and often only requires small coding change, using ARIA attributes or visually hidden text when the visual text isn't sufficient. It's a fundamental accessibility practice that significantly enhances website usability for many users with minimal effort.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tip
&lt;/h3&gt;

&lt;p&gt;To see how a link will be announced by screen readers open your browsers devtools panel, highlight the link you want to inspect, open the accessibility tab and look for the value in the "Name" section. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl9t5ar6w11trkofzgwc4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl9t5ar6w11trkofzgwc4.png" alt="Example screenshot of chrome browser devtools with accessibility tab selected and the Name section underlined" width="538" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>wcag</category>
      <category>a11y</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>WCAG: Alternative Text for Images</title>
      <dc:creator>patrick clancey</dc:creator>
      <pubDate>Wed, 16 Oct 2024 13:04:34 +0000</pubDate>
      <link>https://forem.com/patrick_clancey/wcag-alternative-text-for-images-4dj7</link>
      <guid>https://forem.com/patrick_clancey/wcag-alternative-text-for-images-4dj7</guid>
      <description>&lt;p&gt;The European Union has implemented new accessibility regulations with a compliance deadline of June 28th, 2025. Many companies are proactively taking steps to meet these standards to avoid penalties and ensure their digital platforms are accessible to all users.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.eumonitor.eu/9353000/1/j9vvik7m1c3gyxp/vkz686pm8ozr" rel="noopener noreferrer"&gt;The European Accessibility Act (EAA) - Directive 2019/882&lt;/a&gt;, which establishes a comprehensive set of accessibility rules for digital offerings within the EU market, is going to come into effect next year. The deadline for compliance with this new legislation is June 28th, 2025. WCAG 2 Level AA is widely recognised as a benchmark for achieving EAA compliance.&lt;/p&gt;

&lt;p&gt;With this in mind, I'm taking a look at some of the most common accessibility issues according to The &lt;a href="https://webaim.org/projects/million/" rel="noopener noreferrer"&gt;WebAIM 2024 report on the accessibility of the top 1,000,000 home pages&lt;/a&gt;, who they affect, and how to fix them.&lt;/p&gt;

&lt;p&gt;In this post, I'll be looking at the image alternative (alt) text, why it's important, who it affects, and how to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why alt text matters
&lt;/h2&gt;

&lt;p&gt;Alt text plays a crucial role in making the web more inclusive for all users, especially those who are visually impaired. It’s not just about filling out an attribute in your HTML code; it’s about ensuring every user can experience the full content of your site, regardless of their ability to see the images.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is impacted by missing or poor alt text?
&lt;/h2&gt;

&lt;p&gt;The absence of alt text, or poorly written alt text, impacts several user groups, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Screen Reader Users:&lt;/strong&gt; Screen readers rely on alt text to interpret and vocalise the content of an image. Without alt text, users won’t know what the image represents, missing out on essential information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users with Cognitive Disabilities:&lt;/strong&gt; Descriptive alt text helps users with cognitive disabilities better understand the context of the image within the webpage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low Bandwidth Users:&lt;/strong&gt; Alt text can be beneficial for users with slow internet connections, as it provides a text-based description of an image when it fails to load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search engines:&lt;/strong&gt; Search engines use the alt text to understand what an image represents. Proper alt text helps improve your website's search rankings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By omitting alt text on images that convey meaning, you risk creating a frustrating and exclusionary experience for these users.&lt;/p&gt;

&lt;h2&gt;
  
  
  WCAG alt text guidelines
&lt;/h2&gt;

&lt;p&gt;The WCAG provides clear guidelines to ensure alt text is used effectively. Below are some key criteria that must be followed to meet accessibility standards:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/non-text-content" rel="noopener noreferrer"&gt;WCAG 1.1.1: Non-text Content (Level A)&lt;/a&gt; All non-text content, including images, must have an alt text description unless the image is purely decorative.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context" rel="noopener noreferrer"&gt;WCAG 2.4.4: Link Purpose (In Context) (Level A)&lt;/a&gt; When an image is used as a link, the alt text should describe the link’s purpose, not just the image.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/label-in-name" rel="noopener noreferrer"&gt;WCAG 2.5.3: Label in Name (Level A)&lt;/a&gt; Any image used as a control (e.g., buttons) must have alt text that matches the label presented to users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;WCAG offer clear standards for implementing alt text, primarily under &lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/non-text-content" rel="noopener noreferrer"&gt;WCAG 1.1.1: Non-text Content&lt;/a&gt;. This criterion ensures that all non-text content, including images, has a text alternative. Here are some key principles to follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For images that convey important information, provide descriptive &lt;code&gt;alt&lt;/code&gt; text.&lt;/li&gt;
&lt;li&gt;For decorative images that don’t add meaningful content, use empty &lt;code&gt;alt&lt;/code&gt; attributes (&lt;code&gt;&amp;lt;img alt="" ...&lt;/code&gt; or just &lt;code&gt;&amp;lt;img alt ...&lt;/code&gt;), so screen readers skip over them.&lt;/li&gt;
&lt;li&gt;Avoid redundancy: Don’t include phrases like "image of" or "photo of" in your alt text—this is implied.&lt;/li&gt;
&lt;li&gt;Avoid duplication: Don't duplicate adjacent text&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The alt attribute is non-negotiable for accessibility
&lt;/h2&gt;

&lt;p&gt;Every &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag must include an &lt;code&gt;alt&lt;/code&gt; attribute, without exception. While the attribute doesn't always require a value—decorative images should use an empty &lt;code&gt;alt&lt;/code&gt; —the attribute itself is mandatory. Failing to provide an &lt;code&gt;alt&lt;/code&gt; attribute results in a critical accessibility issue, as screen readers will announce a graphic and some will then read the image’s file path (&lt;code&gt;src&lt;/code&gt;) or file name, which offers no meaningful information to users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Identifying Decorative Images: When to use an empty alt attribute
&lt;/h2&gt;

&lt;p&gt;Not all images on a webpage serve a functional or informative purpose. Some images are purely decorative, added for visual appeal without contributing meaningful content to the page. For these images, you should include an empty &lt;code&gt;alt&lt;/code&gt; attribute, which tells screen readers to ignore the image, allowing users to focus on the content that matters. For help see the &lt;a href="https://www.w3.org/WAI/tutorials/images/decision-tree/" rel="noopener noreferrer"&gt;WAI images decision tree&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to write effective alt text
&lt;/h2&gt;

&lt;p&gt;When writing alt text, it’s essential to consider the purpose of the image and its context within the page. Here are a few best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Be concise but descriptive: Summarise the content of the image in a brief, meaningful way.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- DON'T DO THIS --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"accounts.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"accounts"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- DO THIS INSTEAD --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"accounts.jpg"&lt;/span&gt; 
    &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Our company accounts team posing in front of the Berlin office"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Include relevant information: If an image conveys complex information (e.g., a chart or diagram), summarise the key insights it provides.
&lt;/li&gt;
&lt;/ul&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;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"sales_chart.png"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Line graph showing a 25% increase in sales over the last quarter"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Leave alt text empty for decorative images: If an image is purely decorative and does not convey important information, use an empty alt attribute.
&lt;/li&gt;
&lt;/ul&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;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"border.png"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Testing alt text for accessibility
&lt;/h2&gt;

&lt;p&gt;Verifying the presence and quality of alt text can be done both manually and through automated testing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Manual Testing:&lt;/strong&gt; Try navigating your website with &lt;a href="https://cleanbrowsing.org/help/docs/disable-images-in-browser/" rel="noopener noreferrer"&gt;images disabled&lt;/a&gt; or better still with a screen reader and observe how well the alt text conveys the image content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated Tools:&lt;/strong&gt; Tools like Axe DevTools, WAVE, or Lighthouse can automatically flag images without alt text or those with potentially problematic alt descriptions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Alt text for complex images
&lt;/h2&gt;

&lt;p&gt;Sometimes, images are more complex and can't be fully described in a short piece of text. For these cases, consider linking to a detailed 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;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"graph.png"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"Graph showing Q3 earnings. Full description below"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#full-description"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Read full description of the graph&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
...
&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"full-description"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  Detailed description of the Q3 earnings here...
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: the &lt;code&gt;longdesc&lt;/code&gt; attribute is no longer recommended and shouldn't be used. &lt;/p&gt;

&lt;h2&gt;
  
  
  Video content: Accessibility considerations
&lt;/h2&gt;

&lt;p&gt;Under &lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html" rel="noopener noreferrer"&gt;WCAG 1.1.1: Non-text Content&lt;/a&gt;, videos are also non-text elements and must be made accessible, just like images. Videos can be informative, decorative, or both, but they must be handled properly to ensure that all users can engage with their content. Video accessibility is out of scope of this post. But for more information on this topic see &lt;a href="https://www.w3.org/WAI/media/av/" rel="noopener noreferrer"&gt;Making Audio and Video Media Accessible&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Alt text is a small but essential part of creating accessible and inclusive websites. By following WCAG guidelines and best practices, you can ensure that users relying on screen readers, users with cognitive disabilities, and those with poor connectivity can still fully engage with your content. In addition to fulfilling the legal requirements of the upcoming EAA, providing thoughtful and well-written alt text makes your website more usable and welcoming to everyone.&lt;/p&gt;

</description>
      <category>wcag</category>
      <category>a11y</category>
    </item>
    <item>
      <title>WCAG: The Unseen Impact of Missing Labels</title>
      <dc:creator>patrick clancey</dc:creator>
      <pubDate>Tue, 27 Aug 2024 06:18:03 +0000</pubDate>
      <link>https://forem.com/patrick_clancey/wcag-the-unseen-impact-of-missing-labels-ab5</link>
      <guid>https://forem.com/patrick_clancey/wcag-the-unseen-impact-of-missing-labels-ab5</guid>
      <description>&lt;p&gt;The European Union has implemented new accessibility regulations with a compliance deadline of June 28th, 2025. Many companies are proactively taking steps to meet these standards to avoid penalties and ensure their digital platforms are accessible to all users.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.eumonitor.eu/9353000/1/j9vvik7m1c3gyxp/vkz686pm8ozr" rel="noopener noreferrer"&gt;The European Accessibility Act (EAA) - Directive 2019/882&lt;/a&gt;, which establishes a comprehensive set of accessibility rules for digital offerings within the EU market, is going to come into effect next year. The deadline for compliance with this new legislation is June 28th, 2025. WCAG 2 Level AA is widely recognised as a benchmark for achieving EAA compliance.&lt;/p&gt;

&lt;p&gt;With this in mind, I'm taking a look at some of the most common accessibility issues according to The &lt;a href="https://webaim.org/projects/million/" rel="noopener noreferrer"&gt;WebAIM 2024 report on the accessibility of the top 1,000,000 home pages&lt;/a&gt;, who they affect, and how to fix them.&lt;/p&gt;

&lt;p&gt;In this post, I'll be looking at the missing label, why it's important, who it affects, and how to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Missing Labels on HTML Forms: A Recipe for Confusion and Exclusion
&lt;/h2&gt;

&lt;p&gt;HTML forms without proper labels can be quite challenging for many users. It may seem like a minor mishap to omit these labels, but in reality, it becomes a major accessibility hurdle for diverse user groups. This lack of direction leads to confusion and frustration, making it difficult for users to interact effectively with the website or application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who is Impacted by Missing Form Labels?
&lt;/h3&gt;

&lt;p&gt;Missing form labels impact a large number of users.  Here's why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Screen reader users:&lt;/strong&gt; Screen readers rely on labels to identify form fields and provide context. Without labels, users are left guessing what information to input or even what a button does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users with cognitive disabilities:&lt;/strong&gt; Clear labels are crucial for users who may have difficulty understanding complex instructions or remembering information. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users with motor disabilities:&lt;/strong&gt; Some people can take advantage of speech recognition software that translates the user's spoken words into language that the computer can understand. Having visible labels which are programatically linked with the relevant form elements is critical for the software to link the users commands with the correct input field.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Users with low vision:&lt;/strong&gt; Labels must have sufficient contrast and be easily distinguishable from the surrounding content and positioned close to their respective input fields for easy association.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Importance of Labels: More Than Just Words
&lt;/h3&gt;

&lt;p&gt;Labels serve as vital signposts in the user's journey through a form. They:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Provide context:&lt;/strong&gt; Labels tell users what information is being requested in each field.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guide interaction:&lt;/strong&gt; They clarify the purpose of each field and how to interact with it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improve comprehension:&lt;/strong&gt; Clear labels make forms easier to understand and complete accurately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enhance accessibility:&lt;/strong&gt;  Properly implemented labels are crucial for users who rely on assistive technologies.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  WCAG Guidelines for Form Labels
&lt;/h3&gt;

&lt;p&gt;The Web Content Accessibility Guidelines (WCAG) provide clear guidelines for labelling form elements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WCAG 1.3.1: Info and Relationships (Level A):&lt;/strong&gt;  Information, structure, and relationships conveyed through presentation can be programmatically determined or are available in text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WCAG 2.4.6: Headings and Labels (Level AA):&lt;/strong&gt; Headings and labels describe topic or purpose.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WCAG 3.3.2: Labels or Instructions (Level A):&lt;/strong&gt; Labels or instructions are provided when content requires user input.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Identifying and Fixing Missing Labels
&lt;/h3&gt;

&lt;p&gt;Thankfully, identifying missing labels is relatively straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Manual testing:&lt;/strong&gt; Carefully review all forms and CTAs (Call To Action) on your website and ensure each field has a visible and descriptive label.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated testing:&lt;/strong&gt; Accessibility testing tools like WAVE, Axe, and Lighthouse can automatically detect missing labels and other accessibility issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once identified, fixing missing labels is usually a simple matter of adding the appropriate HTML:&lt;br&gt;
&lt;em&gt;(note: to keep the examples short, I'm not adding the &lt;code&gt;autocomplete&lt;/code&gt; attribute, but by rights, they should be included on form elements that request personal information)&lt;/em&gt;&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="c"&gt;&amp;lt;!-- DON'T DO THIS --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;strong&amp;gt;&lt;/span&gt;Name&lt;span class="nt"&gt;&amp;lt;/strong&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Use a label, with a 'for' attribute --&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;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Name&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;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Best Practices for Effective Form Labels
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Writing Clear and Concise Form Labels
&lt;/h4&gt;

&lt;p&gt;Use plain, simple language and avoid jargon. e.g.&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="c"&gt;&amp;lt;!-- Simple descriptive label --&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;"email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Email address&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;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Using Descriptive Language for Form Labels
&lt;/h4&gt;

&lt;p&gt;Labels should accurately describe the information being requested. e.g.&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="c"&gt;&amp;lt;!-- Describe what data is required --&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;"phone"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Telephone number&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;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"phone"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"phone"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Properly Associating Labels with Input Fields
&lt;/h4&gt;

&lt;p&gt;Use the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; element with the &lt;code&gt;for&lt;/code&gt; attribute linked to the corresponding input's &lt;code&gt;id&lt;/code&gt; or for multi fields (like radio buttons) use &lt;code&gt;aria-labelledby&lt;/code&gt;. e.g.&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="c"&gt;&amp;lt;!-- Use a label, with a 'for' attribute --&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;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Name&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;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- Use a 'aria-labelledby' attribute for 
  multi-field input group --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;fieldset&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Legend with ID for referencing --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;legend&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"petLegend"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Insure your pet&lt;span class="nt"&gt;&amp;lt;/legend&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"catLabel"&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"cat"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Cat&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Cat radio button with aria-labelledby attribute --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"radio"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"cat"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"pet"&lt;/span&gt; 
    &lt;span class="na"&gt;aria-labelledby=&lt;/span&gt;&lt;span class="s"&gt;"petLegend catLabel"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"dogLabel"&lt;/span&gt; &lt;span class="na"&gt;for=&lt;/span&gt;&lt;span class="s"&gt;"dog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Dog&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- Dog radio button with aria-labelledby attribute --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"radio"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"dog"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"pet"&lt;/span&gt; 
    &lt;span class="na"&gt;aria-labelledby=&lt;/span&gt;&lt;span class="s"&gt;"petLegend dogLabel"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Ensure all CTAs have labels
&lt;/h4&gt;

&lt;p&gt;Either add text to the CTA (visually hide it if it's not needed, e.g. if the CTA displays as an icon) or use the &lt;code&gt;aria-label&lt;/code&gt; attribute. Consider a 'close' icon on a search panel;&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="c"&gt;&amp;lt;!-- DON'T DO THIS --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"close-search-icon"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/button&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- add text (can be visually hidden) --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"close-search-icon"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"visually-hidden"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    Close Search
  &lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- or aria-label --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"close-search-icon"&lt;/span&gt; 
  &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Close Search"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Visually distinct and placed appropriately
&lt;/h4&gt;

&lt;p&gt;Ensure labels have sufficient contrast and are easily distinguishable from the surrounding content. Also, position labels close to their respective input fields for easy association.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: Labels are Non-Negotiable
&lt;/h3&gt;

&lt;p&gt;Missing labels are a common accessibility issue with a significant impact on user experience. By following WCAG guidelines and implementing best practices, we can create forms that are accessible, usable, and inclusive for everyone. Remember, clear and descriptive labels are not just a nice-to-have, they are essential for creating a truly accessible web. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>WCAG: Good contrast, good vibes!</title>
      <dc:creator>patrick clancey</dc:creator>
      <pubDate>Fri, 26 Jul 2024 08:45:46 +0000</pubDate>
      <link>https://forem.com/patrick_clancey/wcag-good-contrast-good-vibes-1jco</link>
      <guid>https://forem.com/patrick_clancey/wcag-good-contrast-good-vibes-1jco</guid>
      <description>&lt;p&gt;The new accessibility recommendations from the EU are important guidelines that we should be mindful of. While the value is widely acknowledged, not everyone might have acted on it yet. Now, with a concrete deadline in place - June 28th, 2025 - it becomes an essential task to undertake. Many companies have already begun improving their websites' accessibility. Since contrast often tops the list of common accessibility failures, let's delve into this particular challenge.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.eumonitor.eu/9353000/1/j9vvik7m1c3gyxp/vkz686pm8ozr" rel="noopener noreferrer"&gt;The European Accessibility Act (EAA) - Directive 2019/882&lt;/a&gt;, which establishes a comprehensive set of accessibility rules for digital offerings within the EU market, is going to come into effect next year. The deadline for compliance with this new legislation is June 28th, 2025.&lt;br&gt;
With this in mind, I'm going to take a look at some of the most common accessibility issues according to &lt;a href="https://webaim.org/projects/million/" rel="noopener noreferrer"&gt;The 2024 report on the accessibility of the top 1,000,000 home pages&lt;/a&gt; and how to fix them.&lt;/p&gt;

&lt;p&gt;In this post, I'll be looking at contrast, why it's important, who it affects, and how to fix it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Low Contrast - Who Does It Impact?
&lt;/h2&gt;

&lt;p&gt;A better question might be, who doesn't it impact? The group that won't be affected by low contrast are those using screen readers to access the website. However, for everyone else who relies on visual cues to navigate the site, contrast plays a crucial role. Therefore, it's safe to say that nearly all visually-dependent users will be impacted by the level of contrast on a website.&lt;/p&gt;

&lt;p&gt;At some time or another, we all face issues with our sight, whether it's persistent (e.g., old age, hypermetropia), temporary (e.g., conjunctivitis, hay fever), or situational (e.g., sunny day, phone in low battery mode).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsifxomv7svsycjppks8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsifxomv7svsycjppks8r.png" alt="Three examples of impaired vision; Permanent, low vision. Temporary, eye infection and situational, bright sunlight" width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Having said that, people with colour blindness or other visual impairments are particularly affected by low contrast. It's important to follow the WCAG recommendations and ensure that our interfaces have sufficient contrast to be usable by everybody. &lt;/p&gt;
&lt;h3&gt;
  
  
  WCAG Contrast related Success Criterion
&lt;/h3&gt;

&lt;p&gt;There are four WCAG SC specifically related to contrast levels, they are;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html" rel="noopener noreferrer"&gt;WCAG SC 1.4.3:
Contrast (Minimum) (Level AA)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-enhanced.html" rel="noopener noreferrer"&gt;WCAG SC 1.4.6:
Contrast (Enhanced) (Level AAA)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html" rel="noopener noreferrer"&gt;WCAG SC 1.4.11:
Non-text Contrast (Level AA)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html" rel="noopener noreferrer"&gt;WCAG SC 2.4.13:
Focus Appearance (Level AAA)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Testing for compliance
&lt;/h3&gt;

&lt;p&gt;Firstly, we need to know what issues we have and where they are, so they can be prioritised. Thankfully, contrast is one accessibility issue that can usually be picked up by accessibility tools. There is a good list on &lt;a href="https://www.w3.org/WAI/test-evaluate/tools/list/" rel="noopener noreferrer"&gt;Web Accessibility Evaluation Tools List&lt;/a&gt;. Ideally we want a tool like &lt;a href="https://pa11y.org/" rel="noopener noreferrer"&gt;pa11y&lt;/a&gt; running against a dev server to surface issues way before they go live. For manual testing, a personal favourite of mine is the &lt;a href="https://chromewebstore.google.com/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd" rel="noopener noreferrer"&gt;axe DevTools chrome extension&lt;/a&gt;. Also worth a mention is the stand-alone &lt;a href="https://www.tpgi.com/color-contrast-checker/" rel="noopener noreferrer"&gt;Colour Contrast Analyzer (CCA)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have identified any low contrast elements, you can prioritise fixing them. Starting with elements commonly used across your site. For example, if you have a contrast issue with your global navigation that needs fixing ASAP. Same goes for any CTAs, like form buttons or link texts. And, as you are addressing contrast issues you may as well not pussy foot around with AA, go straight for AAA!&lt;/p&gt;
&lt;h3&gt;
  
  
  Addressing issues
&lt;/h3&gt;

&lt;p&gt;On the good side, technically fixing contrast issues is easy work. Usually it's just a few simple changes to your CSS. The more difficult task is getting approval to make the changes in the first place! If your colour scheme is based on approved corporate colours and/or the designs have been "signed off", it's often a slow process to get approval make global changes to the colour scheme. So with the EU Accessibility Directive coming into force next year it's well worth getting the ball rolling in order to get your necessary updates live in time!&lt;/p&gt;

&lt;p&gt;In my experience it's a good idea to offer some "ready-to-go" alternatives. As the site's product owner might not have time to fully digest the implications and impacts of contrast failures and come up with a solution, they will probably have time to look at three options and point at their favourite.  &lt;/p&gt;

&lt;p&gt;The first step is to explore some alternatives that meet the required contrast levels. Depending on what elements are failing, you'll likely find three or four viable options to consider.&lt;/p&gt;
&lt;h3&gt;
  
  
  Darken
&lt;/h3&gt;

&lt;p&gt;If you have an issue with say a blue which is too light you can usually darken it, whilst still keeping the overall colour pallet. This won't work with colours like green, orange or gold as they don't darken nicely. &lt;br&gt;
There are a number of theming tools like &lt;a href="https://fabricweb.z5.web.core.windows.net/pr-deploy-site/refs/heads/master/theming-designer/" rel="noopener noreferrer"&gt;Theming Designer&lt;/a&gt; or &lt;a href="https://paletton.com/" rel="noopener noreferrer"&gt;Paletton.com&lt;/a&gt;&lt;br&gt;
 which you can use to extend your current pallet to include some WCAG compliant colour variations.&lt;/p&gt;
&lt;h3&gt;
  
  
  Complementary
&lt;/h3&gt;

&lt;p&gt;You can expand the site's colour palette by finding some complementary colours which have higher contrast.&lt;br&gt;
Look for colour wheel generators like &lt;a href="https://www.figma.com/color-wheel/" rel="noopener noreferrer"&gt;Figma color-wheel&lt;/a&gt; or a matching colour generator like &lt;a href="https://mycolor.space/" rel="noopener noreferrer"&gt;mycolor&lt;/a&gt; to get ideas.&lt;/p&gt;
&lt;h3&gt;
  
  
  Invert
&lt;/h3&gt;

&lt;p&gt;You can try inverting the colours, or rather swapping white and black. For example if your issue is buttons that are a light colour with white text you can swap that round so the button is black with the light colour as the text. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxxlnqm6enb223rfclyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxxlnqm6enb223rfclyw.png" alt="Two buttons, one with low contrast and one with compliant contrast" width="800" height="157"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Remove
&lt;/h3&gt;

&lt;p&gt;The nuclear option. Remove the colour palette from the offending elements altogether. Falling back to generic grey scale. This might sound extreme, but, you can select greys that sit nicely within any colour pallet and easily meet the contrast requirements.&lt;/p&gt;
&lt;h2&gt;
  
  
  In the meantime
&lt;/h2&gt;

&lt;p&gt;In the short term remove any CSS that is actively causing issues, for example check your CSS doesn't actively suppress the focus indicator (this was quite a common practise, so if you have inherited a code base, please check!).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* remove anything that looks similar to these */&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;outline-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="cp"&gt;!important&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt; &lt;span class="cp"&gt;!important&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Developers used to routinely remove the system outline so code similar to the above is still quite common. Read  &lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html" rel="noopener noreferrer"&gt;WCAG SC 2.4.13 Focus Appearance&lt;/a&gt; to get up to speed with requirements around the focus indicator.&lt;/p&gt;

&lt;p&gt;It's worth checking when the user has requested High Contrast that your CSS is not overriding any important rules. Always a good idea to check this by enabling High Contrast on your machine to see what happens!&lt;/p&gt;

&lt;p&gt;Implementing something is better than nothing. I recommend you pick your personal favourite solution and implement it within the CSS &lt;code&gt;prefers-contrast: more&lt;/code&gt; media query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* can't change this until the theme update is approved */&lt;/span&gt; 
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;gold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefers-contrast&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;more&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* random example; */&lt;/span&gt;
  &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:focus-visible&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;outline-offset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* or if you are using css variables */&lt;/span&gt;
&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--accent-color-1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;gold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefers-contrast&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;more&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
  &lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="py"&gt;--accent-color-1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;At least users who have specifically asked for high contrast will get it. And it shows you are making an effort to address the site's issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  In conclusion
&lt;/h2&gt;

&lt;p&gt;Ensuring good contrast in web design is crucial for accessibility and usability. It affects everyone who visually accesses a website, whether they have permanent, temporary, or situational vision impairments. Adhering to the WCAG success criteria related to contrast not only enhances user experience but also helps meet the upcoming European Accessibility Act requirements. While technically simple to fix, these changes often require approval due to established colour schemes and designs. Therefore, it's important to start early, prioritize common elements, and aim for AAA compliance. Remember, there are various strategies to address contrast issues, from darkening colours and finding complementary ones to inverting or even removing the colour palette. In the meantime, avoid suppressing focus indicators and consider implementing high-contrast options for users who prefer them. Ultimately, improving contrast is about making your digital content more accessible and enjoyable for all users.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;(Thank you to &lt;a href="https://unsplash.com/@jan_huber" rel="noopener noreferrer"&gt;jan huber&lt;/a&gt; for the cover image)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>wcag</category>
      <category>a11y</category>
    </item>
    <item>
      <title>CSS wordwrap: Because Sometimes One Line Just Isn't Enough!</title>
      <dc:creator>patrick clancey</dc:creator>
      <pubDate>Fri, 28 Jun 2024 10:48:07 +0000</pubDate>
      <link>https://forem.com/patrick_clancey/a-deep-dive-into-css-and-text-wrapping-5862</link>
      <guid>https://forem.com/patrick_clancey/a-deep-dive-into-css-and-text-wrapping-5862</guid>
      <description>&lt;p&gt;Controlling how text wraps with CSS can be a headache. CSS offers a number of text wrapping options to keep your content readable and responsive. So your text doesn't break the page layout or look like it lost a fight with a blender.&lt;/p&gt;

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

&lt;p&gt;Text wrapping is vital in web design for content readability and visual appeal across different devices and screen sizes. CSS provides properties like &lt;code&gt;overflow-wrap&lt;/code&gt;, &lt;code&gt;word-break&lt;/code&gt;, &lt;code&gt;text-wrap&lt;/code&gt; and &lt;code&gt;hyphens&lt;/code&gt; that allow developers to control text behavior at the edge of its container. This post explores the practical use of these properties to manage long strings, prevent overflow, and enhance user experience. These CSS rules are essential when dealing with unbreakable URLs, optimizing text readability and maintaining responsive designs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping vs Truncation
&lt;/h2&gt;

&lt;p&gt;For the purposes of this post I'm only going to focus on text that needs to be visible to the user, hence it needs to wrap and ignore the truncation option entirely. Although, there is some overlap in the use-cases, text truncation has a more specific use-case and is specifically for hiding content over a specific length. So I'm just going to skip over it here!&lt;/p&gt;

&lt;h2&gt;
  
  
  Text wrapping style options
&lt;/h2&gt;

&lt;p&gt;Let's jump straight in and take a look at some styles we can use to prevent strings form overflowing their container.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  TLDR
&lt;/h2&gt;

&lt;p&gt;Ok, I'm going to skip the boring bits and go straight to the summary. (For reference, the rather dry detail about each style follows further down the page.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* use for headings */&lt;/span&gt;
&lt;span class="nc"&gt;.my-h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;hyphens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;break-word&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* use for general static copy */&lt;/span&gt;
&lt;span class="nc"&gt;.my-text-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;hyphens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;break-word&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* 
  use specifically for breaking long strings or
  on large/dynamic content containers which 
  may contain long strings
 */&lt;/span&gt;
&lt;span class="nc"&gt;.my-url-container&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nc"&gt;.my-very-big-text-container&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nc"&gt;.my-dynamic-text-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;break-word&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As with most things CSS, there is more than one way to solve the problem. But which is the best? Let's look at three use-cases. Headings where long words might overflow on small devices, static content containers which could contain long strings like URLs, and containers that could either contain a lot of content or are repeatedly updated dynamically. Let's take these three in revers order. For contains that contain a lot of content, or are dynamically updated we can use &lt;code&gt;overflow-wrap: break-word&lt;/code&gt; this will keep the content within the containers' boundaries. For short or static content (see below for detail about hyphens and performance) we can add &lt;code&gt;hyphens: auto&lt;/code&gt; this will improve readability, but we still keep &lt;code&gt;overflow-wrap: break-word&lt;/code&gt; which will ensure that long strings still wrap if the content is in a language that the browser doesn't know how to hyphenate or the long strings aren't words. And lastly for headings (e.g. H1) we'll keep &lt;code&gt;hyphens&lt;/code&gt; and &lt;code&gt;overflow-wrap&lt;/code&gt; and we'll also add &lt;code&gt;text-wrap: balance&lt;/code&gt; this adds visual balance to the mix, so the header wraps nicely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The boring bit
&lt;/h2&gt;

&lt;p&gt;Let's look at the styles in more detail&lt;/p&gt;

&lt;h3&gt;
  
  
  hyphens: auto;
&lt;/h3&gt;

&lt;p&gt;Using &lt;code&gt;hyphens: auto&lt;/code&gt; in CSS allows for automatic, language-aware hyphenation of text, which can significantly enhance the readability and aesthetic of text blocks, particularly in responsive designs and narrow layouts.&lt;/p&gt;

&lt;h4&gt;
  
  
  hyphens, on the downside
&lt;/h4&gt;

&lt;p&gt;This does more than just breaking long strings that don't fit in the container. You might still get text overflowing the container, for example a very long number won't be hyphenated so will still remain on one line. &lt;code&gt;hyphens: auto&lt;/code&gt; has a performance overhead due to the processing required to determine hyphenation points, especially in dynamic or large text content. To mitigate the impact of this, particularly for containers with extensive or frequently changing text, I recommend only using &lt;code&gt;hyphens: auto&lt;/code&gt; on specific elements that would benefit from it, don't just randomly add it here, there and everywhere!&lt;/p&gt;

&lt;h3&gt;
  
  
  overflow-wrap: break-word;
&lt;/h3&gt;

&lt;p&gt;This style ensures that long words or unbreakable strings (such as URLs) break and wrap onto the next line instead of overflowing their container.&lt;/p&gt;

&lt;h4&gt;
  
  
  overflow-wrap, on the downside
&lt;/h4&gt;

&lt;p&gt;Arbitrary word breaks at any point, which can lead to awkward or hard-to-read text breaks, disrupting the natural flow of reading. A small performance overhead (although less than that of hyphens).&lt;/p&gt;

&lt;h3&gt;
  
  
  word-wrap: break-word;
&lt;/h3&gt;

&lt;p&gt;This is an alias for &lt;code&gt;overflow-wrap: break-word&lt;/code&gt;, which is the standardized property name. Use &lt;code&gt;overflow-wrap: break-word&lt;/code&gt; instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  word-wrap: break-all;
&lt;/h3&gt;

&lt;p&gt;I have nothing good to say about &lt;code&gt;word-wrap: break-all&lt;/code&gt;. I can't think of any use-case for it. Only consider using this if you have a specific issue that isn't fixed by any of the other options!&lt;/p&gt;

&lt;h4&gt;
  
  
  break-all, on the downside
&lt;/h4&gt;

&lt;p&gt;It breaks words excessively at any character, leading to awkward and very hard-to-read text at all widths.&lt;/p&gt;

&lt;h2&gt;
  
  
  Balancing text-wrapping
&lt;/h2&gt;

&lt;p&gt;The style &lt;code&gt;text-wrap: balance&lt;/code&gt; does NOT break strings. This is shorthand property which controls how text inside an element is wrapped, it's not standard (yet) but has solid support in all major browser vendors. I use this on main header elements (e.g. h1) to visually balance the content and make it more aesthetically pleasing. This is part of the &lt;a href="https://www.w3.org/TR/css-text-4/#text-wrapping" rel="noopener noreferrer"&gt;css-text-4 text-wrapping proposal&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  text-wrap balance on the downside
&lt;/h3&gt;

&lt;p&gt;I haven't seen any detailed performance metrics so I might be making too much of the potential performance impact. But nonetheless, I would only use this on specific static elements like headers. I wouldn't use this on large content blocks or anything that's repeatedly updated dynamically.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8a52a9lk24xjpb42mmv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm8a52a9lk24xjpb42mmv.png" alt="Latin text twice, wrapping in different places to show the effect of the CSS text-wrap: balance rule" width="800" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;p&gt;Some useful resources on text wrapping in CSS&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_text/Wrapping_breaking_text" rel="noopener noreferrer"&gt;Wrapping and breaking text&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.hubspot.com/website/css-wrap-text" rel="noopener noreferrer"&gt;CSS Text Wrapping: A Beginner's Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap" rel="noopener noreferrer"&gt;CSS text-wrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap" rel="noopener noreferrer"&gt;CSS overflow-wrap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/TR/css-text-4/#text-wrapping" rel="noopener noreferrer"&gt;css-text-4 text-wrapping proposal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.erwinhofman.com/blog/use-text-wrap-balance-to-improve-inp/" rel="noopener noreferrer"&gt;Use text-wrap: balance; to improve design and INP&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>ux</category>
      <category>frontend</category>
    </item>
  </channel>
</rss>
