<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://web.dev/</id>
  <title>Zama Khan Mohammed on web.dev</title>
  <updated>2026-04-15T23:21:06Z</updated>
  <author>
    <name>Zama Khan Mohammed</name>
  </author>
  <link href="https://web.dev/authors/mohamedzamakhan/feed.xml" rel="self"/>
  <link href="https://web.dev/"/>
  <icon>https://web-dev.imgix.net/image/admin/GFORxGF2V01nQ1p4lJ3E.jpg?auto=format</icon>
  <logo>https://web.dev/images/shared/rss-banner.png</logo>
  <subtitle>Our latest news, updates, and stories by Zama Khan Mohammed.</subtitle>
  
  
  <entry>
    <title>Audit your Angular app&#39;s accessibility with codelyzer</title>
    <link href="https://web.dev/accessible-angular-with-codelyzer/"/>
    <updated>2019-07-03T00:00:00Z</updated>
    <id>https://web.dev/accessible-angular-with-codelyzer/</id>
    <content type="html" mode="escaped">&lt;p&gt;Making your app accessible means that all users, including those with special needs, can use it and understand the content. According to the &lt;a href=&quot;https://www.who.int/disabilities/world_report/2011/report.pdf&quot; rel=&quot;noopener&quot;&gt;World Health Report&lt;/a&gt;, more than a billion people—about 15% of the world&#39;s population—have some form of disability. So &lt;a href=&quot;https://web.dev/accessible&quot;&gt;accessibility&lt;/a&gt; is a priority for any development project.&lt;/p&gt;
&lt;p&gt;In this post you&#39;ll learn how to add &lt;a href=&quot;https://github.com/mgechev/codelyzer&quot; rel=&quot;noopener&quot;&gt;codelyzer&#39;s&lt;/a&gt; accessibility checks to the build process for an Angular app. This approach lets you catch accessibility bugs directly in your text editor as you code.&lt;/p&gt;
&lt;h2 id=&quot;using-codelyzer-to-detect-inaccessible-elements&quot;&gt;Using codelyzer to detect inaccessible elements &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/accessible-angular-with-codelyzer/#using-codelyzer-to-detect-inaccessible-elements&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/mgechev/codelyzer&quot; rel=&quot;noopener&quot;&gt;codelyzer&lt;/a&gt; is a tool that sits on top of &lt;a href=&quot;https://palantir.github.io/tslint/&quot; rel=&quot;noopener&quot;&gt;TSLint&lt;/a&gt; and checks whether Angular TypeScript projects follow a set of linting rules. Projects set up with the &lt;a href=&quot;https://cli.angular.io/&quot; rel=&quot;noopener&quot;&gt;Angular command line interface (CLI)&lt;/a&gt; include codelyzer by default.&lt;/p&gt;
&lt;p&gt;codelyzer has over 50 rules for checking if an Angular application follows best practices. Of those, there are about 10 rules for enforcing accessibility criteria. To learn about the various accessibility checks provided by codelyzer and their rationales, see the &lt;a href=&quot;https://medium.com/ngconf/new-accessibility-rules-in-codelyzer-v5-0-0-85eec1d3e9bb&quot; rel=&quot;noopener&quot;&gt;New Accessibility rules in Codelyzer&lt;/a&gt; article.&lt;/p&gt;
&lt;p&gt;Currently, all the accessibility rules are experimental and disabled by default. You can enable them by adding them to the TSLint configuration file (&lt;code&gt;tslint.json&lt;/code&gt;):&lt;/p&gt;
&lt;div&gt;&lt;pre class=&quot;language-json&quot;&gt;&lt;code class=&quot;language-json&quot;&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;rulesDirectory&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;[&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;    &lt;span class=&quot;token string&quot;&gt;&quot;codelyzer&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token punctuation&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token property&quot;&gt;&quot;rules&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;    ...&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-accessibility-alt-text&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-accessibility-elements-content&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-accessibility-label-for&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-accessibility-tabindex-no-positive&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-accessibility-table-scope&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-accessibility-valid-aria&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-click-events-have-key-events&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-mouse-events-have-key-events&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-no-autofocus&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;mark class=&quot;highlight-line highlight-line-active&quot;&gt;    &lt;span class=&quot;token property&quot;&gt;&quot;template-no-distracting-elements&quot;&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token boolean&quot;&gt;true&lt;/span&gt;&lt;/mark&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;highlight-line&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;TSLint works with all popular text editors and IDEs. To use it with VSCode, install the &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=eg2.tslint&quot; rel=&quot;noopener&quot;&gt;TSLint plugin&lt;/a&gt;. In WebStorm, TSLint is enabled by default. For other editors, check the TSLint &lt;a href=&quot;https://github.com/palantir/tslint#tslint&quot; rel=&quot;noopener&quot;&gt;README&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With codelyzer&#39;s accessibility checks set up, you get a popup showing accessibility errors in TypeScript files or inline templates as you code:&lt;/p&gt;
&lt;figure&gt;
  &lt;img alt=&quot;A screenshot of a codelyzer popup in a text editor.&quot; decoding=&quot;async&quot; height=&quot;433&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/admin/XArrTmBXfijqQ8AteI76.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
  &lt;figcaption&gt;A codelyzer popup showing a form element labeling error.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;To perform linting over the entire project (including external templates), use the &lt;code&gt;ng lint&lt;/code&gt; command:&lt;/p&gt;
&lt;img alt=&quot;Linting with Angular CLI&quot; decoding=&quot;async&quot; height=&quot;342&quot; loading=&quot;lazy&quot; sizes=&quot;(min-width: 800px) 800px, calc(100vw - 48px)&quot; src=&quot;https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&quot; srcset=&quot;https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=200 200w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=228 228w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=260 260w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=296 296w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=338 338w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=385 385w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=439 439w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=500 500w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=571 571w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=650 650w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=741 741w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=845 845w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=964 964w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=1098 1098w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=1252 1252w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=1428 1428w, https://web-dev.imgix.net/image/admin/sZdIj5CNklqppTk0UCf3.png?auto=format&amp;w=1600 1600w&quot; width=&quot;800&quot; /&gt;
&lt;h2 id=&quot;supplementing-codelyzer&quot;&gt;Supplementing codelyzer &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/accessible-angular-with-codelyzer/#supplementing-codelyzer&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.chrome.com/docs/lighthouse/overview/&quot; rel=&quot;noopener&quot;&gt;Lighthouse&lt;/a&gt; is another tool you can use to enforce accessibility practices in your Angular application. The main difference between codelyzer and Lighthouse is when their checks get performed. Codelyzer statically analyzes the application at development time, without running it. This means that during development you can get direct feedback in your text editor or in the terminal. By contrast, Lighthouse actually runs your application and performs a bunch of checks using dynamic analysis.&lt;/p&gt;
&lt;p&gt;Both tools can be useful parts of your development flow. Lighthouse has better coverage given the checks it performs, while codelyzer allows you to iterate faster by getting constant feedback in your text editor.&lt;/p&gt;
&lt;h2 id=&quot;enforcing-accessibility-checks-in-your-continuous-integration&quot;&gt;Enforcing accessibility checks in your continuous integration &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/accessible-angular-with-codelyzer/#enforcing-accessibility-checks-in-your-continuous-integration&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Introducing static accessibility checks in your continuous integration (CI) can be a great enhancement for your development flow. With codelyzer you can easily enforce certain accessibility rules or other practices by running &lt;code&gt;ng lint&lt;/code&gt; on each code modification (for example for each new pull request).&lt;/p&gt;
&lt;p&gt;This way, even before you proceed to code review, your CI can tell you if there are any accessibility violations.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion &lt;a class=&quot;headline-link&quot; href=&quot;https://web.dev/accessible-angular-with-codelyzer/#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To improve the accessibility of your Angular app:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Enable the experimental accessibility rules in codelyzer.&lt;/li&gt;
&lt;li&gt;Perform accessibility linting over your entire project using the Angular CLI.&lt;/li&gt;
&lt;li&gt;Fix all the accessibility problems reported by codelyzer.&lt;/li&gt;
&lt;li&gt;Consider using Lighthouse for accessibility audits at runtime.&lt;/li&gt;
&lt;/ol&gt;
</content>
    <author>
      <name>Zama Khan Mohammed</name>
    </author><author>
      <name>Minko Gechev</name>
    </author>
  </entry>
</feed>
