acop - enforcing accessibility for web pages




acop is a command line utility for verifying accessibility in web pages

With acop, you can specify a url you want to test for accessibility and acop would run through a checklist of accessibility concerns and return any issues found


gem install acop


Access the command line help

acop --help

Specify the url you want accessibility tested

acop -u

Specify the urls to be tested in a file (new line separated)

acop -f ./list_of_urls.txt

Scaffold rspec tests for a particular url or list of urls in a file. The gem will create a spec directory(if none exists) from where it is run. In addition it will create a spec file with a describe block for a particular url or list of urls. If the spec file being used already exists, the gem will append to the file.

acop -u -g rspec

acop -f list_of_urls -g rspec


Standard Web Programming

<!DOCTYPE Resource SYSTEM 'foo.dtd'>

  • Doctype should be specified if frame or iframe elements exist on the page

Appropriate Markup

  • HTML visual formatting elements like <b></b>, <i></i>, <center></center>, <font></font>, <u></u> should not be used. Use CSS for formatting instead



  • Page title element should not be empty or missing
  • There should not be more than one page title

<frameset><frame title=""...

  • Frame elements should have title attributes
  • Frame elements should not have title attributes empty

<iframe title=""...

  • iFrame elements should have title attributes
  • iFrame elements should not have title attributes empty


<body><p><h1>Heading 1</h1><h2>Heading 2</h2><p><h3>Heading 3</h3></p></body>

  • Page must contain atleast one h1 element
  • The h1 element should have non empty text
  • Heading elements that follow the h1 element should be properly nested
  • All subheadings(h2..h6) should have non empty text

HTML lang

<html lang='en'></html>

  • You should declare the primary language of a page with the html lang attribute


<body><a href="">Go to Google</a></body>

  • Hyperlinks should always have text associated with them
  • There should not be duplicate text for hyperlinks on the same page


<input type='image'...

  • Image inputs elements should have alt attributes
  • Image inputs elements should not have alt attributes empty


  • Image elements should have alt attributes
  • Image elements should not have alt attributes empty


  • Image elements inside anchor tags should have empty alt attributes


<area shape='rect' coords='0,0,82,126' href='sun.htm' alt='Sun'>

  • Area elements should have an alt attribute
  • Area element alt attribute cannot be empty

Flashing content

  • The blink and marquee elements must not be used. Blinking and moving text are an accessibility problems for people with photosenstive epilepsy and visual impairments.


<form><textarea id='area' rows='3' cols='3'></textarea><label for='area'/></form>

  • Every form element should have a corresponding label (the label 'for' attribute should match the form field 'id' attribute)

<form><input id='in' type='text' value="input_value"/></form>

  • Form input elements of type submit|reset|button should not have labels, instead have a non empty 'value' attribute

<label for="label1">Label 1</label><label for="label2">Label 2</label>

  • Labels for form controls should have non-empty text

<legend>Legend 1</legend>

  • Legends specified for fieldsets or otherwise should have non-empty text

<button type="button">Button 1</button>

  • Buttons should have non-empty text


<table summary="summary"><th>Table Heading</th><tr><td>Data 1</td></tr></table>

  • Table should have a table header
  • Table should have a non empty summary attribute
  • Table headers should have a non empty scope attribute specifying whether it is for a row or column


Running the rspec tests

cd spec; rspec acop_spec.rb

Additional Resources

While this gem does attempt to flag as many accessibility concerns as possible, there are numerous others that cannot be automated or are difficult to automate. Below are excellent resources that I would encourage anybody using this gem to also go through


Report bugs and requests at the Github page.


Copyright 2013 by Avinash Padmanabhan under the MIT license (see the LICENSE file).