- Language Attribute
- Semantic HTML
- ARIA
- Wayfinding
- Images
- Links
- JavaScript
- Testing
- Misc HTML markup notes
- Declare a language attribute on the html element so screen readers can use correct pronunciation
- Use semantic headings and structure to establish a document outline. Current consensus recommends using H1-6 heading rank rather than repeated H1 tags in nested sectioning elements.
- Use the
button
element for JS interaction points and similar non-linking components. If a button is not of thesubmit
,reset
, ormenu
types, usetype="button"
to designate a generic button.- The
a
tag should only be used when using thehref
attribute to link "to other web pages, files, locations within the same page, email addresses, or any other URL" (ref).
- The
HTML5 elements should be used whenever possible to communicate the element's role in the page. Some notable examples include:
main
for the primary content of the page, most appropriately excluding repeated elements (e.g., sidebars, decorative marquees, site header and footer)article
for self-contained content that could conceivably belong in an RSS feed, such as blog posts, press releases, and event information (in both page and individually in index listings)section
for thematically grouped content in a component that doesn't justify a stronger semantic elementnav
for all significant navigation link listsaside
for complementary content, such as advertising, "related article" lists, and repeated page sidebars
Semantic HTML5 elements provide additional meaning to an HTML document for other technologies. Notably, using these roles not only serves visitors using accessibility technologies, but it also makes parsing code easier for fellow developers.
- In most cases, using semantic HTML elements makes explicit designation of landmark roles unnecessary (e.g., using
role="complementary"
on anaside
element). The exceptions would be when they are serving slightly atypical roles. An example of the latter would be settingrole="search"
on anaside
element when it houses a search field. - For more complex interactive components, use ARIA attributes to help assistive technologies navigate website functionality. Accessibility advocate Heydon Pickering has gathered useful examples of using ARIA roles for components such as tab groups, tooltips, and alert dialogs.
- Document should be navigable by keyboard
- Use
<img></img>
for images that are content. Use CSS background images for design "chrome".
- Use alternative text for any image used as content. Alternative text should provide a description of the image. If the image is presentational or decorative use an empty
alt=""
attribute instead ofrole="presentation"
.
- Links should have a focus state
:focus
- Links in "body" text should be underlined
- Link purpose should be clear from the link text alone
- Use unobtrusive JavaScript
- Provide
no-js
alternatives for users that don't have JavaScript enabled
- Use device agnostic events such as
onclick
andonfocus
- Provide keyboard alternative events
- Satisfy each item of the HHS.gov Email 508 Checklist
-
Sites should be tested during development to ensure basic accessibility standards are being met (WCAG 2.0 AA or higher if required by the project). One simple way to do this is to install the WAVE Toolbar browser extension.
-
We currently use pA11y for command line and CI testing of projects before merges/deployments using apostrophe-site-map to generate a list of URLs for pA11y to crawl.
You should always give iframes a title
attribute with basic description of their contents. For example, if you're embedding a map of office locations: title="Office locations map"
. REF