{"id":58021,"date":"2023-08-22T13:59:18","date_gmt":"2023-08-22T08:29:18","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=58021"},"modified":"2024-06-10T15:37:57","modified_gmt":"2024-06-10T10:07:57","slug":"part-4-web-accessibility-nvda-screen-reader-for-effective-debugging","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/part-4-web-accessibility-nvda-screen-reader-for-effective-debugging\/","title":{"rendered":"Part 4 \u2013 Web Accessibility: NVDA Screen Reader for effective debugging"},"content":{"rendered":"<p>This is the second example of the <strong>web aria accessibility<\/strong> implementation, where we will fix the issues using the <strong>NVDA Screen Reader<\/strong>.<\/p>\n<p><span style=\"font-weight: 400;\">Here, we will get to know whether it will read the webpage or not and check the multiple accessibility errors.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You can download this tool from this link &#8211; <\/span><a href=\"https:\/\/www.nvaccess.org\/download\/\"><span style=\"font-weight: 400;\">https:\/\/www.nvaccess.org\/download\/<\/span><\/a><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-58017 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1-1024x576.png\" alt=\"tool download image\" width=\"625\" height=\"352\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1-1024x576.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1-300x169.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1-768x432.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1-1536x864.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1-624x351.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img1.png 1920w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/> <img decoding=\"async\" loading=\"lazy\" class=\"alignleft wp-image-58018 size-large\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2-1024x576.png\" alt=\"tool download image 2\" width=\"625\" height=\"352\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2-1024x576.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2-300x169.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2-768x432.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2-1536x864.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2-624x351.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img2.png 1920w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><b><\/b><\/p>\n<p>&nbsp;<\/p>\n<p><b>\u21d2 Code SNIPPET 2 &#8211;<\/b><\/p>\n<pre>&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\r\n&lt;style&gt;\r\n* {\r\nbox-sizing: border-box;\r\n}<\/pre>\n<pre>ul {\r\nlist-style-type: none;\r\npadding: 0;\r\nmargin: 0;\r\n}<\/pre>\n<pre>ul li {\r\nborder: 1px solid #ddd;\r\nmargin-top: -1px; \/* Prevent double borders *\/\r\nbackground-color: #f6f6f6;\r\npadding: 12px;\r\ntext-decoration: none;\r\nfont-size: 18px;\r\ncolor: black;\r\ndisplay: block;\r\nposition: relative;\r\n}<\/pre>\n<pre>ul li:hover {\r\nbackground-color: #eee;\r\n}<\/pre>\n<pre>ul li a {\r\ncolor: inherit;\r\ntext-decoration: unset;\r\n}<\/pre>\n<pre>.close {\r\nposition: absolute;\r\nright: 32px;\r\ntop: 50%;\r\ntransform: translateY(-50%);\r\nwidth: 22px;\r\nheight: 22px;\r\nopacity: 0.3;\r\n}\r\n.close:hover {\r\nopacity: 1;\r\n}\r\n.close:before, .close:after {\r\nposition: absolute;\r\nleft: 10px;\r\ncontent: ' ';\r\nheight: 22px;\r\nwidth: 2px;\r\nbackground-color: #333;\r\n}\r\n.close:before {\r\ntransform: rotate(45deg);\r\n}\r\n.close:after {\r\ntransform: rotate(-45deg);\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;header&gt;&lt;\/header&gt;\r\n\r\n&lt;main&gt;\r\n&lt;div class=\"container\"&gt;\r\n&lt;h2&gt;Closable List Items&lt;\/h2&gt;\r\n&lt;p&gt;Click on the \"x\" symbol to the right of the list item to close\/hide it.&lt;\/p&gt;\r\n\r\n&lt;ul&gt;\r\n&lt;li&gt;Adele&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li&gt;Agnes&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n\r\n&lt;li&gt;Billy&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li&gt;Bob&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n\r\n&lt;li&gt;Calvin&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li&gt;Christina&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li&gt;Cindy&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n&lt;\/div&gt;\r\n&lt;\/main&gt;\r\n\r\n&lt;footer&gt;&lt;\/footer&gt;\r\n\r\n&lt;script&gt;\r\nvar closebtns = document.getElementsByClassName(\"close\");\r\nvar i;\r\n\r\nfor (i = 0; i &lt; closebtns.length; i++) {\r\nclosebtns[i].addEventListener(\"click\", function() {\r\nthis.parentElement.style.display = 'none';\r\n});\r\n}\r\n&lt;\/script&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><strong>This is the browser view of the above initial code.<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-58019\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3-1024x576.png\" alt=\"Initial code browser view\" width=\"625\" height=\"352\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3-1024x576.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3-300x169.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3-768x432.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3-1536x864.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3-624x351.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img3.png 1920w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">While using the keyboard navigation <\/span><b>TAB<\/b><span style=\"font-weight: 400;\"> key the page will start to navigate, but here the navigation is not coming on both <em>list items<\/em> or the <em>close button<\/em>.<\/span><\/p>\n<h3>Fix 1 &#8211;<\/h3>\n<p><span style=\"font-weight: 400;\">Now, to make it work, these are the required changes for <em>list items<\/em> &#8211;\u00a0<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Adding <\/span><b>role<\/b><span style=\"font-weight: 400;\"> to &lt;ul&gt; \/ &lt;ol&gt; list.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Adding <\/span><b>role<\/b><span style=\"font-weight: 400;\"> to &lt;li&gt;<\/span><\/li>\n<\/ol>\n<pre>&lt;ul role=\"list\"&gt;\r\n&lt;li role=\"listitem\"&gt;Adele&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Agnes&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n\r\n&lt;li role=\"listitem\"&gt;Billy&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Bob&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n\r\n&lt;li role=\"listitem\"&gt;Calvin&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Christina&lt;span class=\"close\"&gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Cindy&lt;\/li&gt;\r\n&lt;\/ul&gt;<\/pre>\n<p><span style=\"font-weight: 400;\">Here, by adding these, the <strong>NVDA screen reader<\/strong> on page refresh will read this as a <strong>list<\/strong>.<\/span><\/p>\n<h3>Fix 2 &#8211;<\/h3>\n<p><span style=\"font-weight: 400;\">Now to get the focus on the close button and to describe this button, we have to add the following &#8211;\u00a0<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><b>role<\/b><span style=\"font-weight: 400;\"> in describing the HTML tag<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>tabindex<\/b><span style=\"font-weight: 400;\"> to get the focus on the close button<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>aria-label<\/b> to describe the button<\/li>\n<\/ol>\n<p>Here, the final code will look like this &#8211;<\/p>\n<pre>&lt;ul role=\"list\"&gt;\r\n&lt;li role=\"listitem\"&gt;Adele&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Agnes&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n\r\n&lt;li role=\"listitem\"&gt;Billy&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Bob&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n\r\n&lt;li role=\"listitem\"&gt;Calvin&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Christina&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;li role=\"listitem\"&gt;Cindy&lt;span class=\"close\" tabindex=\"0\" role=\"button\" aria-label=\"close button\" &gt;&lt;\/span&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;<\/pre>\n<p><span style=\"font-weight: 400;\">After adding this, we will get the focus by keyboard navigation, and on page refresh, it will clearly define the close button so that the user gets to know what it really is.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Also, the button is focused on <strong>keyboard navigation<\/strong>, which can easily be closed by pressing the <\/span><b>space<\/b><span style=\"font-weight: 400;\"> and <\/span><b>enter<\/b><span style=\"font-weight: 400;\"> buttons.<\/span><\/p>\n<p><strong>This is the browser view of the final code.<\/strong><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-58020\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4-1024x576.png\" alt=\"Final code browser view\" width=\"625\" height=\"352\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4-1024x576.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4-300x169.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4-768x432.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4-1536x864.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4-624x351.png 624w, \/blog\/wp-ttn-blog\/uploads\/2023\/08\/Part4-Img4.png 1920w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>In the next blog, we will look at the checkbox announce state for aria accessibility. There are other implementations in this chain of blogs.<\/p>\n<p>Link to <a href=\"https:\/\/www.tothenew.com\/blog\/part-5-web-accessibility-fixing-checkbox-to-announce-the-checked-unchecked-state-while-using-screen-reader\/\"><b>Part 5 &#8211; Web Accessibility: Fixing Checkbox to announce the \u201cchecked\u201d \/ \u201cunchecked\u201d state while using screen reader<\/b><\/a><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>This is the second example of the web aria accessibility implementation, where we will fix the issues using the NVDA Screen Reader. Here, we will get to know whether it will read the webpage or not and check the multiple accessibility errors. You can download this tool from this link &#8211; https:\/\/www.nvaccess.org\/download\/ &nbsp; \u21d2 Code [&hellip;]<\/p>\n","protected":false},"author":1622,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":71},"categories":[5868,3429],"tags":[5340,5343,5344,5341,5339],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58021"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1622"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=58021"}],"version-history":[{"count":5,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58021\/revisions"}],"predecessor-version":[{"id":58243,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/58021\/revisions\/58243"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=58021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=58021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=58021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}