A couple of days ago I released RAAKT – The Ruby Accessibility Analysis Kit gem (I know, it really needs a better name). RAAKT is a gem that can be used independently of Rails and my plan was to make a Rails plugin that would add a custom assert method that did the check. It turns out that it only takes five lines of code so there is no need for a plugin. So let’s see how you can integrate accessibility checks into your current Rails application.
Ruby on rails is a great framework for developing web applications. With the increased developer productivity you can put a lot more effort into usability and accessibility. To get started I have created a library (they are called “gems” in the Ruby world) called RAAKT with methods to assert basic accessibility in HTML documents. You will need the programming language Ruby to run RAAKT.
My focus has been to implement machine measurable issues (so no content checking) that never should be present in a document. Other tools give you a massive overdose of checks that end up with results with the wording “if applicable”. In my opinion these do not really help a developer who is new to the field of accessibility.
Currently the RAAKT module will do the following tests on your markup:
- check document structure: Verify that headings are correctly structured (h1 -> h2 etc)
- check tables: Verify that all tables have headers (th elements).
- check for formatting elements: Make sure no font, b, i, blink or marquee elements have been used.
- check has heading: Verify that the document has at least one h1 heading.
- check form: Verifies that all form input fields (except hidden fields) have a corresponding label element.
- check link text: Verifies that all link elements are unambiguous (two links with different targets should not have the same link text. Yes, that means all your edit links in lists). Use the title attribute to separate links.
- check title: Verify that a non-empty title element is available.
- check frames: If frames are used, verify that each frame has a descriptive title attribute.
- check images: Verify that all images have an alt attribute.
- check refresh: Make sure that no client-side meta refresh is present.
- check for nested tables: Verify that no nested tables are present.
- check for language info: Make sure the html element has a lang attribute indicating what language your document is in.
I plan on implementing more checks soon.