Form input placeholder
attributes are helpful for providing tips to (sighted) users on the format of content required. Often times, due to design decisions, a placeholder
is used to replace a more semantic label
element. Unfortunately, accessible placeholder
browser support isn't complete and placeholder often lack sufficient color contrast.
- Redesign to include a proper
label
- Use
aria-label
oraria-labelledby
to provide assistive text - Visually hide
label
elements (in an accessible manner)
While we're paying attention to our placeholder text, be sure to add better contrast to you placeholder text:
::moz-placeholder,
::-webkit-input-placeholder,
:-ms-input-placeholder {
color: #626262; /* 4.5:1 contrast ratio on #FFFFFF */
}
- HTML5 Accessibility Chops: the placeholder attribute from the Paciello Group (February 2011)
These placeholder css rules need to be defined separately as otherwise they are ignored by the browser - more info in this stack overflow thread (http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css).
I've added a quick gist here with rules separated and extra rule added for firefox <19 (I know some people won't care about this one)
https://gist.github.com/clarehyam/7483034