├── README ├── .gitignore ├── MIT-LICENSE.txt ├── wai-aria-example.html ├── stijl.css └── index.html /README: -------------------------------------------------------------------------------- 1 | From: 2 | http://mcdlr.com/ 3 | 4 | See it live at: 5 | http://mcdlr.com/wai-aria-cheatsheet/ 6 | 7 | What started as a simple WAI-ARIA Landmark Roles Cheatsheet turned out to be a full-blown article about the subject. 8 | 9 | Since I had the different elements of the page done, I figured “Why not fill them with content, then?” and that is what I did. 10 | 11 | Also, it appears that to date there was no other WAI-ARIA Cheatsheet, so this will prove useful to developers. Hope it does! 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## OSX.gitignore 2 | 3 | .DS_Store 4 | 5 | # Thumbnails 6 | ._* 7 | 8 | # Files that might appear on external disk 9 | .Spotlight-V100 10 | .Trashes 11 | 12 | 13 | ## vim.gitignore 14 | .*.sw[a-z] 15 | *.un~ 16 | Session.vim 17 | 18 | 19 | ## Archives.gitignore 20 | 21 | # It's better to unpack these files and commit the raw source because 22 | # git has its own built in compression methods. 23 | *.7z 24 | *.jar 25 | *.rar 26 | *.zip 27 | *.gz 28 | *.bzip 29 | *.xz 30 | *.lzma 31 | 32 | #packing-only formats 33 | *.iso 34 | *.tar 35 | 36 | #package management formats 37 | *.dmg 38 | *.xpi 39 | *.gem 40 | *.egg 41 | *.deb 42 | *.rpm 43 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012 Nicolas Barrera 2 | http://mcdlr.com/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /wai-aria-example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Title of your document 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |

Title of your document

14 | 34 |
35 | 36 |
37 |

Main Content

38 |

Juicy content

39 |
40 | 41 | 45 | 46 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /stijl.css: -------------------------------------------------------------------------------- 1 | /* 2 | ____ _ _ _ 3 | | _ \ _ __ _ _ _ __ ___ _ __ ___ ___ _ __| | | | ___ __ _ __| | 4 | | | | | '__| | | | '_ ` _ \| '_ ` _ \ / _ \ '__| |_| |/ _ \/ _` |/ _` | 5 | | |_| | | | |_| | | | | | | | | | | | __/ | | _ | __/ (_| | (_| | 6 | |____/|_| \__,_|_| |_| |_|_| |_| |_|\___|_| |_| |_|\___|\__,_|\__,_| 7 | Made all this stuff, done with a lotta love :D 8 | */ 9 | 10 | article, 11 | aside, 12 | details, 13 | figcaption, 14 | figure, 15 | footer, 16 | header, 17 | hgroup, 18 | nav, 19 | section { 20 | display: block; 21 | } 22 | html { 23 | font-size: 100%; 24 | overflow-y: scroll; 25 | background-color: yellow; 26 | padding: 2% 5%; 27 | background-color: #eee; 28 | -webkit-text-size-adjust: 100%; 29 | } 30 | body { 31 | max-width: 80em; 32 | margin: 0 auto; 33 | font-size: 1em; 34 | line-height: 1.6; 35 | font-family: sans-serif; 36 | color: #333; 37 | } 38 | a { 39 | color: #44c; 40 | } 41 | a:hover { 42 | color: #11f; 43 | } 44 | h1, 45 | h2 { 46 | line-height: 1.2; 47 | text-shadow: 0 2px 0 rgba(255, 255, 255, .7); 48 | } 49 | h1 { 50 | margin: 0; 51 | font-size: 2em; 52 | } 53 | h2 { 54 | margin: .5em 0 0 0; 55 | padding: 1em 0 0 0; 56 | font-size: 1.5em; 57 | } 58 | h2:first-child { 59 | margin-top: 0; 60 | } 61 | p { 62 | margin: 1em 0; 63 | } 64 | ul, 65 | ol { 66 | margin: 1em 0; 67 | padding: 0 0 0 1em; 68 | } 69 | nav ul, 70 | nav ol { 71 | margin: 0; 72 | padding: 0; 73 | list-style-type: none; 74 | } 75 | a[rel~="help"] { 76 | position: absolute; 77 | top: 0; 78 | right: 0; 79 | display: inline-block; 80 | text-decoration: none; 81 | color: #777; 82 | } 83 | a[rel~="help"]:hover { 84 | text-decoration: underline; 85 | color: #555; 86 | } 87 | pre { 88 | white-space: pre; 89 | white-space: pre-wrap; 90 | word-wrap: break-word; 91 | background-color: #ccc; 92 | color: #111; 93 | padding: 0 2em; 94 | -moz-box-shadow: 0 0 20px rgba(120, 120, 120, .4) inset; 95 | -webkit-box-shadow: 0 0 20px rgba(120, 120, 120, .4) inset; 96 | box-shadow: 0 0 20px rgba(120, 120, 120, .4) inset; 97 | } 98 | code { 99 | font-size: 1.2em; 100 | font-family: monospace; 101 | line-height: 1; 102 | } 103 | a code { 104 | display: inline-block; 105 | padding: .5em; 106 | background-color: rgba(255, 255, 120, .5); 107 | text-align: right; 108 | } 109 | a code:hover { 110 | background-color: #ff7; 111 | } 112 | p a[rel~="help"] { 113 | position: static; 114 | display: inline; 115 | color: #44c; 116 | } 117 | p a[rel~="help"]:hover { 118 | color: #11f; 119 | } 120 | p code { 121 | } 122 | p a code { 123 | display: inline; 124 | padding: .15em .4em; 125 | background-color: rgba(255, 255, 120, .3); 126 | } 127 | 128 | [role="banner"], 129 | [role="main"], 130 | [role="complementary"], 131 | [role="contentinfo"] { 132 | position: relative; 133 | margin: 0 0 2% 0; 134 | padding: 2% 3%; 135 | border: 1px solid #bbb; 136 | background-color: #ddd; 137 | -moz-box-shadow: 0 0 10px rgba(120, 120, 120, .3); 138 | -webkit-box-shadow: 0 0 10px rgba(120, 120, 120, .3); 139 | box-shadow: 0 0 10px rgba(120, 120, 120, .3); 140 | } 141 | [role="banner"] { 142 | overflow: auto; 143 | } 144 | [role="banner"] h1 { 145 | max-width: 77%; 146 | margin: 0 0 .7em 0; 147 | } 148 | nav { 149 | } 150 | [role="navigation"] ol { 151 | width: 50%; 152 | float: left; 153 | } 154 | [role="navigation"] li { 155 | width: 33.3333333%; 156 | float: left; 157 | } 158 | [role="navigation"] a { 159 | width: 87%; 160 | float: left; 161 | padding: 4%; 162 | text-align: center; 163 | background-color: #eee; 164 | text-decoration: none; 165 | -moz-box-shadow: 0 0px 10px rgba(0, 0, 0, 0.05) inset, 0 -3px 10px rgba(0, 0, 0, 0.1); 166 | -webkit-box-shadow: 0 0px 10px rgba(0, 0, 0, 0.05) inset, 0 -3px 10px rgba(0, 0, 0, 0.1); 167 | box-shadow: 0 0px 10px rgba(0, 0, 0, 0.05) inset, 0 -3px 10px rgba(0, 0, 0, 0.1); 168 | } 169 | [role="navigation"] a:hover { 170 | background-color: #fafafa; 171 | text-decoration: underline; 172 | } 173 | [role="search"] { 174 | width: 40%; 175 | float: right; 176 | text-align: right; 177 | margin: .5em 0 0 0; 178 | } 179 | [type="search"] { 180 | width: 15em; 181 | } 182 | [type="submit"] { 183 | } 184 | [role="main"] { 185 | width: 65%; 186 | float: left; 187 | } 188 | [role="complementary"] { 189 | width: 20%; 190 | float: right; 191 | } 192 | [role="complementary"] h2 { 193 | font-size: 1.2em; 194 | } 195 | [role="contentinfo"] { 196 | clear: both; 197 | } 198 | #role-navigation { 199 | top: 42%; 200 | right: 50.8%; 201 | } 202 | #role-search { 203 | top: 43%; 204 | right: 3%; 205 | } 206 | 207 | @media (max-width: 920px) { 208 | body { 209 | font-size: .9em; 210 | } 211 | h1 { 212 | font-size: 1.6em; 213 | } 214 | h2 { 215 | font-size: 1.4em; 216 | } 217 | [role="main"], 218 | [role="complementary"] { 219 | width: auto; 220 | float: none; 221 | } 222 | } 223 | @media (max-width: 480px) { 224 | html { 225 | padding: 2%; 226 | background-color: #ddd; 227 | } 228 | body { 229 | font-size: .8em; 230 | } 231 | [role="banner"], 232 | [role="main"], 233 | [role="complementary"], 234 | [role="contentinfo"] { 235 | background-color: #eee; 236 | } 237 | [type="search"] { 238 | width: 50%; 239 | } 240 | [role="navigation"] a { 241 | background-color: #ccc; 242 | -moz-box-shadow: none; 243 | -webkit-box-shadow: none; 244 | box-shadow: none; 245 | } 246 | } 247 | @media (max-width: 320px) { 248 | html { 249 | padding: 0; 250 | } 251 | [role="banner"], 252 | [role="main"], 253 | [role="complementary"], 254 | [role="contentinfo"] { 255 | margin: 7% 0; 256 | padding: 7% 4%; 257 | border: none; 258 | } 259 | [role="navigation"] { 260 | width: 50%; 261 | float: left; 262 | } 263 | [role="search"] { 264 | width: 40%; 265 | float: right; 266 | text-align: right; 267 | margin: .5em 0 0 0; 268 | } 269 | [role="navigation"], 270 | [role="search"] { 271 | float: none; 272 | width: auto; 273 | overflow: auto; 274 | margin: 14% 0 0 0; 275 | } 276 | #role-navigation { 277 | top: 37%; 278 | right: 4%; 279 | } 280 | #role-search { 281 | top: 68%; 282 | right: 4%; 283 | } 284 | } 285 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WAI ARIA Cheatsheet · mcdlr 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 |
28 |
29 | Go to mcdlr homepage 30 |
31 |
32 | Fork me on Github! 33 |
34 |
35 | 36 | 37 | 38 | 39 |
40 |

WAI-ARIA Landmark Roles Cheatsheet

41 | 58 | 59 | 60 | 61 | <header role="banner"> 62 | 63 | 64 | 65 | 66 | <nav role="navigation"> 67 | 68 | 69 | 70 | 71 | <form role="search"> 72 | 73 | 74 |
75 | 76 |
77 |

What is WAI-ARIA?

78 |

In practice, WAI-ARIA gives us more attributes to assign to elements. There are two kinds of attributes, the role attribute and the aria-.* attributes (“.*” meaning that what follows “aria-” is variable)

79 |

These new attributes seek to increase the semantics of our documents, facilitate the development of Rich Internet Applications and improve Accessibility

80 |

The aria-.* attributes and the values they can have gives us information about the state of an element, and are more geared toward Rich Application Development.

81 |

The role attribute and the values it can have gives us information about the purpose of an element in question (is it navigation? Main data? Or tangential content?). Assistive technologies can use this information to jump directly to the main content, immediately detect the main navigation of the document, etc.

82 |

This document focuses on the more common WAI-ARIA Landmark Roles, as you can see displayed in yellow. Also, just because you see them here does not mean that they all should be used, it all depends on the actual content of your page. Some Roles are suitable for more than what is shown here, e.g. complementary is suitable for sidebars and also other kind of contents, for more info on any given Role just click on them.

83 |

Why should I use WAI-ARIA Landmark Roles?

84 |

You will enrich the semantics of your documents and improve accessibility.

85 |

You will also have better “hooks” to target your elements, avoiding excessive use of id or class attributes. WAI-ARIA Role values can not be repeated, but HTML5 elements can (you can have several header or footer elements in a single page), so it is easier to make sure you are targeting your actual document header, instead of affecting every possible header element that may in the future be put on your document

86 |

Can I see some code?

87 |

Yeah, sure! :D here is a basic document skeleton with proper role attributes and values:

88 |
 89 |     
 90 | <!doctype html>
 91 | <html>
 92 | <head>
 93 | <title>Title of your document</title>
 94 | <meta charset="utf-8">
 95 | <meta name="description" content="description of your document">
 96 | </head>
 97 | 
 98 | 
 99 | <body>
100 | 
101 | <header role="banner">
102 |   <h1>Title of your document</h1>
103 |   <nav role="navigation">
104 |     <ol>
105 |       <li>
106 |         <a href="#">alpha</a>
107 |       </li>
108 |       <li>
109 |         <a href="#">bravo</a>
110 |       </li>
111 |       <li>
112 |         <a href="#">charlie</a>
113 |       </li>
114 |       <li>
115 |         <a href="#">delta</a>
116 |       </li>
117 |     </ol>
118 |     <form role="search">
119 |       <input type="search" placeholder="Need to find something?">
120 |       <input type="submit" value="search">
121 |     </form>
122 |   </nav>
123 | </header>
124 | 
125 | <main role="main">
126 |   <h2>Main Content</h2>
127 |   <p>Juicy content</p>
128 | </main>
129 | 
130 | <aside role="complementary">
131 |   <h2>Sidebar</h2>
132 |   <p>Complementary content</p>
133 | </aside>
134 | 
135 | <footer role="contentinfo">
136 |   <h2>Footer</h2>
137 |   <p>Information about the document</p>
138 | </footer>
139 | 
140 | </body>
141 | </html>
142 |     
143 |   
144 | 145 | 146 | 147 | <main role="main"> 148 | 149 | 150 |
151 | 152 | 175 | 176 | 185 | 186 | 187 | 188 | 189 | 190 | 194 | 199 | 200 | 201 | 202 | 203 | --------------------------------------------------------------------------------