<?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: Looms VN</title>
    <description>The latest articles on DEV Community by Looms VN (@loomsvn).</description>
    <link>https://dev.to/loomsvn</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4212493%2Fb018bca2-6edb-447f-b1f8-4d622e1ac69f.jpg</url>
      <title>DEV Community: Looms VN</title>
      <link>https://dev.to/loomsvn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/loomsvn"/>
    <language>en</language>
    <item>
      <title>Make a contact form’s success message audible without moving focus</title>
      <dc:creator>Looms VN</dc:creator>
      <pubDate>Thu, 26 Nov 2026 03:16:30 +0000</pubDate>
      <link>https://dev.to/loomsvn/make-a-contact-forms-success-message-audible-without-moving-focus-3jmn</link>
      <guid>https://dev.to/loomsvn/make-a-contact-forms-success-message-audible-without-moving-focus-3jmn</guid>
      <description>&lt;p&gt;Try submitting a contact form with a screen reader while leaving keyboard focus on the Send button. The green confirmation may appear on screen while the reader says nothing. A useful fix is to put the confirmation in a status region that already exists when the page loads.&lt;/p&gt;

&lt;p&gt;Here is a minimal example. The callback belongs in the success branch of the form handler, after the server has accepted the enquiry.&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;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Send enquiry&lt;span class="nt"&gt;&amp;lt;/button&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="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"enquiry-status"&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;"status"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;showEnquiryReceipt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'enquiry-status'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Enquiry received. Your reference is '&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;reference&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&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;The empty paragraph does two jobs. It gives sighted readers a stable place to find the receipt, and its status role asks assistive technology to announce changes politely. Keep it in the accessibility tree while empty. Making the paragraph with &lt;code&gt;display: none&lt;/code&gt; and revealing it at the same moment as the text can make the announcement unreliable. The reference in this example is a fictional enquiry number such as &lt;code&gt;DEMO-42&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A quick acceptance check&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;With a screen reader on, tab to Send enquiry and activate it. Keep your hands off the keyboard until the test response arrives.&lt;/li&gt;
&lt;li&gt;For a successful test response, listen for the reference once. Confirm that the same reference is visible and that keyboard focus is still on Send enquiry.&lt;/li&gt;
&lt;li&gt;Repeat with an unsuccessful response. The success receipt must stay empty. Show a distinct, visible error and keep the entered message available so the visitor can retry.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This example covers an in-place submission. A form that navigates to a new confirmation page needs a meaningful page title and heading as well. Test the interaction with the browser and screen reader your visitors actually use.&lt;/p&gt;

&lt;p&gt;Written by &lt;a href="https://looms.vn/" rel="noopener noreferrer"&gt;Looms VN&lt;/a&gt; for teams maintaining the enquiry forms on their websites.&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>frontend</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
