NOTE: a flashing cursor will not trigger a seizure
may be helpful to have a way for users to disable animations entirely
typography
healthy body copy font size is 16px-20px
optimal line length between 45 and 75 characters, with 66 being ideal
for line height, good rule of thumb is ~150% of X height, easily achieved by setting line height to 125% of text size
avoid justifying text
text in all caps can be problematic
can be hard for people to read
may be misread by screen readers
Developing Accessible Navigation and Content
Headings
should only have 1 occurrence of h1
should be sure not to skip levels
<!-- BAD --><h1>Main Title</h1><p>This is the main description.</p><h2>Secondary Title</h2><p>This is the secondary description.</p><h4>Nested Title</h4><p>...</p><h2>Another Secondary Title</h2><p>...</p><!-- GOOD --><h1>Main Title</h1><p>This is the main description.</p><h2>Secondary Title</h2><p>This is the secondary description.</p><h3>Nested Title</h3><p>...</p><h2>Another Secondary Title</h2><p>...</p>
Lists
Unordered List
Use when no order of sequence or importance is needed
sometimes may be removed by developers (unintentionally or otherwise)
inaccessible without them
tab order
logical and easy to follow pattern
follow visual flow of information
left to right/right to left (depending on language)
top to bottom
controlled by document structure
non-navigable items
divs or spans as buttons become completely inaccessible
skip to content link
need to allow skipping of long navigation lists
tabbing steps through each link and control
should allow users to skip large chunks of navigation
easy way to implement is add a link before these lists with text such as "Skip to main content" with an href that has the id of the HTML element to skip to
if you don't like the visual aesthetics of it, you can use CSS to make it visible only when it's focused
CSS Cascade Overview
Applied in order:
default browser styles
external CSS
style sheets embedded in page
inline styles
end user custom configuration settings
End user is ultimately in control so we should build with flexibility in mind
use scalable values (em, rem, %, etc.)
don't rely on CSS alone to convey meaning
use proper, semantic HTML whenever possible
Visually Hiding Elements Only For Assistive Technologies
if possible, use more descriptive text (instead of "read more", something like "read more of the 1st post")
if it's visually important to just have generic text in a link, can use CSS
<style>a::after{content:"Read More";}</style><ahref="blog-post-01.html">
Read More of the 1st Post
</a>
Accessible Form Design
Identify Required Fields
reduces cognitive load
don't rely on color alone!
Add Special Formatting Requirements
reduces cognitive load
prevents frustration
Add Clear, Descriptive Form Labels
all fields need a label
don't solely use placeholder text to label fields (disappears when we type)
Provide Clear Feedback for Errors and Warnings
don't rely on color alone
add a message
Native vs. Custom Form Controls
Should always use native controls if possible as custom markup will often require a lot of other HTML attributes and/or JavaScript to make them accessible.
Labeling and Describing Form Controls
Use label tags with the for attribute, which should have the value of the id for the related form field.
<!-- BEFORE --><span><inputid="country"requiredhiddentype="hidden"/><spanid="exp_elem"class="account__label">
Country <spanclass="account__required">*</span></span><divid="exp_wraper"><divtabindex="0"id="exp_button"onclick="toggleDropdown(event)"></div><ultabindex="0"id="exp_elem_list"class="hidden"><liid="exp_elem_au">Australia</li><liid="exp_elem_br">Brazil</li><liid="exp_elem_ca">Canada</li><liid="exp_elem_cl">Chile</li><!-- ... --></ul></div></span><!-- AFTER --><span><inputid="country"requiredhiddentype="hidden"/><spanid="exp_elem"class="account__label">
Country <spanclass="account__required">*</span></span><divid="exp_wraper"><buttontabindex="0"aria-labelledby="exp_elem exp_button"aria-haspopup="listbox"id="exp_button"onclick="toggleDropdown(event)"></button><ultabindex="0"role="listbox"aria-labelledby="exp_elem"id="exp_elem_list"class="hidden"><liid="exp_elem_au"role="option">Australia</li><liid="exp_elem_br"role="option">Brazil</li><liid="exp_elem_ca"role="option">Canada</li><liid="exp_elem_cl"role="option">Chile</li><!-- ... --></ul></div></span>
Creating Accessible Form Validation
Feedback for Both Success and Failure
report if there are errors
report successful submission too
Error Can Be Read By Assistive Technologies
don't rely on icons and colors only
inaccessible to those who don't see color
inaccessible to those who can't see
Avoid Disabling the Submit Button
the disabled button won't ever receive focus for someone using keyboard only to navigate
better to let users submit data at any time and if error exists, set focus on first field with error
should not be redundant to context of content around it
should not restate that it's an image/graphic/illustration/etc.
commonly recommended that every image has alt attribute
in some cases, it can be empty: if content around image would make the text redundant, sometimes icons, etc.
Images Containing Content
for the most part, just add text content in image to alt text
for images applied as CSS backgrounds, use role="image" and aria-label="..."
Purely Decorative Images
for img tags, use empty alt attribute
could also apply the CSS as a background image
aria-hidden="true"
Complex Images
can't be described in a short sentence or two
charts, graphs, diagrams, illustrations, etc.
require more in-depth descriptions
if description length allows, can add detailed description inside figcaption
<figurerole="group"><div><imgalt="Super Complex Thing"src="..."/></div><figcaption><h2>
Super Complex Thing
</h2><dl><dt>
First part of complex thing
</dt><dd>...</dd></dl></figcaption></figure>
if description is sufficiently long, put description in its own page and link to page in figcaption
Video, Audio, and Accessibility
Captions
text alternatives for time-based media (video or audio)
help those that are hearing impaired or do not have access to sound