Drupal Association members fund grants that make connections all over the world.
The Accessibility project is a suite of modules that provide accessibility testing for content authors, theme designers, and developers. Once enabled, site maintainers can enable one or many accessibility tests — for example, checking that an image is missing its "alt" attribute — many of which are aligned with national or international guidelines like WCAG 2.0. All tests have a Severity level which corresponds to how sure the test is that an error is occurring.
- Severe - Test does not generate false positives.
- Moderate - Test can generate false positives, but results should be flagged for further review.
- Suggestion - Test cannot check this section of the page (i.e. flash content) and a human reviewer is required.
Note: while these modules help catch common or simple accessibility errors on your site, they are not meant as a replacement for a thorough review by an accessibility expert. There are many other best practices site creators can follow to ensure their content is accessible, and which can be used in concert with the accessibility project.
Installation and setup
Before you can enable any accessibility modules, you will need to install the following modules:
Setting up tests
While there are several modules in the project, the Accessibility module itself provides all mechanisms for testing pages. Use the normal process to enable the Accessibility module, then navigate to Administration < Configuration < Accessibility tests. This page will show you any tests which have already been installed.
Accessibility tests are entities, and can have additional custom fields added to them. These are displayed to users when an error is found on their page, and behave just like fields in content types. You can manage your fields for accessibility tests under the Manage fields and Manage display sections of the Accessibility tests administration page.
Once enabled for the first time, your site will have no tests installed. You can add new tests under the Import section or tab of the Accessibility tests administration page. Here you can check off one test at a time, or click any of the guidelines on the top of the page to check off tests that correspond to that guideline. Clicking the Import tests button will then create a new entry for each test.
Editing existing tests
All tests can be edited under the Accessibility tests administration page. The following are special fields that alter the way tests behave:
- Machine name - The name of the test, usually corresponding to a QUAIL test; however, there is a method for other modules to define their own tests.
- Test name - The actual name of the test, visible when managing tests, and displayed to users when they see errors.
- Severity - The severity level of the test.
- Test is active - Whether the test is active or not. Disabling a test is useful if you wish to keep the test information, but disable it for the time being.
Content accessibility module
To check content on your site, you will need to enable the Content Accessibility module. Once enabled, you can navigate to Administration < Configuration < Accessibility < Content to configure the way the module behaves on your site. Users are able to view accessibility problems with content only if they are in a role granted the permission Check content for accessibility. The following site-wide configuration options are available:
- Automatically check page - If the current user has permission to view errors, show them immediately instead of requiring they click the toggle to do so.
- Show accessibility check toggle - If disabled, the toggle is not shown to the user.
- Toggle settings - Language for the toggle when turning testing on or off.
- You have been prevented from submitting this form because of the following accessibility errors.... - If a field is setup to prevent a form from being saved if there are accessibility problems, this message will help explain what the user should do.
The toggle allows users to turn testing on or off.
Testing occurs only on fields that have been configured to be tested. This allows a lot of flexibility to turn testing on or off only for certain use cases. To enable testing, for example, the Body field of an article, navigate to the Manage fields section of the content type you wish to edit, then click the edit link for any field that has the type of Long text or Long text with summary. Other fields are ignored (because users cannot enter HTML into them); however, there is an API if you wish to add testing to another field you identify.
When editing an existing field, or creating a new one, you will find the following options:
- Check this field for accessibility - When checked, if this field is displayed then users with permission will see accessibility checks.
- Block saving content if there are any errors that are... - When checked, whenever a user is editing this field, and a test occurs with any of the enabled severity levels, then the user is prevented from saving the form.
Accessibility WYSIWYG module
Just like the red underlines in text editors gives users instant feedback on spelling errors, the Accessibility WYSIWYG module gives the same sort of interface for accessibility problems. To give your content authors this ability, enable the Accessibility WYSIWYG module, along with either the WYSIWYG module or the CKEditor module, and navigate to the appropriate setting page for those modules to add the accessibility check button to the editor. Any enabled tests on your site are then run against any WYSIWYG editor enabled on your site.
Note: Currently, the Accessibility WYSIWYG module only supports TinyMCE and CKEditor 3 for the WYSIWYG module, and CKEditor 4 for the CKEditor module.
Accessibility Reporting module
To get reports on which pages have the most errors, or other views that are helpful for human reviewers or content editors, enable the Accessibility Reporting module. Once enabled, when any user with the User will report accessibility problems permission views a Long text or Long text with summary field which has the option Report on accessibility problems in this field enabled, their browser will silently scan that field for accessibility problems and post them to your site.
Reports can be built using the Views module, and a sample view is installed with the module is enabled.