Browse code

Fixed misuse of ARIA roles (see http://dev.opera.com/articles/view/introduction-to-wai-aria/)

Frederic Hemberger authored on 21/09/2011 at 12:48:38
Showing 12 changed files
... ...
@@ -41,7 +41,7 @@ body {
41 41
   max-width: $max-width;
42 42
   position: relative;
43 43
   margin: 0 auto;
44
-  > header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav[role=pagination] {
44
+  > header, > nav, > footer, #content > article, #content > div > article, #content > div > section, nav.pagination {
45 45
     @extend .group;
46 46
     padding-left: $pad-min;
47 47
     padding-right: $pad-min;
... ...
@@ -67,7 +67,7 @@ body {
67 67
 
68 68
 #content { > div, > article { width: 100%; }}
69 69
 
70
-aside[role=sidebar] {
70
+aside.sidebar {
71 71
   float: none;
72 72
   padding: 0 $pad-min 1px;
73 73
   background-color: lighten($sidebar-bg, 2);
... ...
@@ -88,7 +88,7 @@ aside[role=sidebar] {
88 88
 
89 89
 body.sidebar-footer {
90 90
   @media only screen and (min-width: 750px) {
91
-    aside[role=sidebar]{ @include collapse-sidebar; }
91
+    aside.sidebar{ @include collapse-sidebar; }
92 92
   }
93 93
   #content { margin-right: 0px; }
94 94
   .toggle-sidebar { display: none; }
... ...
@@ -98,7 +98,7 @@ body.sidebar-footer {
98 98
   body > header { font-size: 1em; }
99 99
 }
100 100
 @media only screen and (min-width: 750px) {
101
-  aside[role=sidebar] { @include collapse-sidebar; }
101
+  aside.sidebar { @include collapse-sidebar; }
102 102
 }
103 103
 @media only screen and (min-width: 768px) {
104 104
   body { -webkit-text-size-adjust: auto; }
... ...
@@ -120,7 +120,7 @@ body.sidebar-footer {
120 120
       float: left;
121 121
     }
122 122
   }
123
-  aside[role=sidebar] {
123
+  aside.sidebar {
124 124
     @extend .group;
125 125
     width: $sidebar-width-medium - $sidebar-pad-medium*2;
126 126
     padding: 0 $sidebar-pad-medium $sidebar-pad-medium;
... ...
@@ -147,7 +147,7 @@ body.sidebar-footer {
147 147
       padding-bottom: $pad-wide/2;
148 148
     }
149 149
   }
150
-  aside[role=sidebar] {
150
+  aside.sidebar {
151 151
     width: $sidebar-width-wide - $sidebar-pad-wide*2;
152 152
     padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide;
153 153
     .collapse-sidebar & {
... ...
@@ -60,7 +60,7 @@ $page-border-bottom: darken($footer-bg, 5) !default;
60 60
 a {
61 61
   @include link-colors($link-color, $hover: $link-color-hover, $focus: $link-color-hover, $visited: $link-color-visited, $active: $link-color-active);
62 62
 }
63
-aside[role=sidebar] a {
63
+aside.sidebar a {
64 64
   @include link-colors($sidebar-link-color, $hover: $sidebar-link-color-hover, $focus: $sidebar-link-color-hover, $active: $sidebar-link-color-active);
65 65
 }
66 66
 a {
... ...
@@ -121,7 +121,7 @@ article + article {
121 121
   display: inline-block;
122 122
 }
123 123
 
124
-#content nav[role=pagination] {
124
+#content nav.pagination {
125 125
   text-align: center;
126 126
   font-size: .95em;
127 127
   div {
... ...
@@ -31,8 +31,8 @@ body > nav {
31 31
       }
32 32
     }
33 33
   }
34
-  fieldset[role=site-search]{ float: right; width: 48%; }
35
-  fieldset[role=mobile-nav]{ float: left; width: 48%;
34
+  fieldset[role=search]{ float: right; width: 48%; }
35
+  fieldset.mobile-nav{ float: left; width: 48%;
36 36
     select{ width: 100%; font-size: .8em; border: 1px solid #888;}
37 37
   }
38 38
   ul { display: none; }
... ...
@@ -85,8 +85,8 @@ body > nav {
85 85
       width: $sidebar-width-medium - $pad-medium*2 - $sidebar-pad-medium - 58px;
86 86
       .search { width: 91%; }
87 87
     }
88
-    fieldset[role=mobile-nav] { display: none; }
89
-    fieldset[role=site-search]{ width: 99%; }
88
+    fieldset.mobile-nav { display: none; }
89
+    fieldset[role=search]{ width: 99%; }
90 90
   }
91 91
   @media only screen and (min-width: 992px) {
92 92
     form {
... ...
@@ -1,7 +1,7 @@
1 1
 .side-shadow-border {
2 2
   @include box-shadow(lighten($sidebar-bg, 5) 0 1px);
3 3
 }
4
-aside[role=sidebar] {
4
+aside.sidebar {
5 5
   color: $sidebar-color;
6 6
   text-shadow: lighten($sidebar-bg, 8) 0 1px;
7 7
   a { @extend .force-wrap; }
... ...
@@ -1,4 +1,4 @@
1
-<ul role=main-navigation>
1
+<ul class="main-navigation">
2 2
   <li><a href="{{ root_url }}/">Blog</a></li>
3 3
   <li><a href="{{ root_url }}/blog/archives">Archives</a></li>
4 4
 </ul>
... ...
@@ -1,11 +1,11 @@
1
-<ul role=subscription data-subscription="rss{% if site.subscribe_email %} email{% endif %}">
1
+<ul class="subscription" data-subscription="rss{% if site.subscribe_email %} email{% endif %}">
2 2
   <li><a href="{{ site.subscribe_rss }}" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
3 3
   {% if site.subscribe_email %}
4 4
     <li><a href="{{ site.subscribe_email }}" rel="subscribe-email" title="subscribe via email">Email</a></li>
5 5
   {% endif %}
6 6
 </ul>
7 7
 <form action="{{ site.simple_search }}" method="get">
8
-  <fieldset role="site-search">
8
+  <fieldset role="search">
9 9
     <input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" />
10 10
     <input class="search" type="text" name="q" results="0" placeholder="Search"/>
11 11
   </fieldset>
... ...
@@ -1,14 +1,14 @@
1 1
 {% capture root_url %}{{ site.root | strip_slash }}{% endcapture %}
2 2
 {% include head.html %}
3 3
 <body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}>
4
-  <header>{% include header.html %}</header>
5
-  <nav role=navigation>{% include navigation.html %}</nav>
4
+  <header role="banner">{% include header.html %}</header>
5
+  <nav role="navigation">{% include navigation.html %}</nav>
6 6
   <div id="main">
7 7
     <div id="content">
8 8
       {{ content | expand_urls: root_url }}
9 9
     </div>
10 10
   </div>
11
-  <footer>{% include footer.html %}</footer>
11
+  <footer role="contentinfo">{% include footer.html %}</footer>
12 12
   {% include disqus.html %}
13 13
   {% include google_analytics.html %}
14 14
   {% include google_plus_one.html %}
... ...
@@ -3,7 +3,7 @@ layout: default
3 3
 ---
4 4
 
5 5
 <div>
6
-<article>
6
+<article role="article">
7 7
   {% if page.title %}
8 8
   <header>
9 9
     <h1 class="entry-title">{{ page.title | titlecase }}</h1>
... ...
@@ -32,7 +32,7 @@ layout: default
32 32
 {% endif %}
33 33
 </div>
34 34
 {% unless page.sidebar == false %}
35
-<aside role=sidebar>
35
+<aside class="sidebar">
36 36
   {% if site.page_asides.size %}
37 37
     {% include_array page_asides %}
38 38
   {% else %}
... ...
@@ -4,7 +4,7 @@ single: true
4 4
 ---
5 5
 
6 6
 <div>
7
-<article class="hentry">
7
+<article class="hentry" role="article">
8 8
   {% include article.html %}
9 9
   <footer>
10 10
     <p class="meta">
... ...
@@ -25,7 +25,7 @@ single: true
25 25
 {% endif %}
26 26
 </div>
27 27
 {% unless page.sidebar == false %}
28
-<aside role=sidebar>
28
+<aside class="sidebar">
29 29
   {% if site.post_asides.size %}
30 30
     {% include_array post_asides %}
31 31
   {% else %}
... ...
@@ -10,7 +10,7 @@ layout: default
10 10
       {% include article.html %}
11 11
     </article>
12 12
   {% endfor %}
13
-  <nav role="pagination">
13
+  <nav class="pagination">
14 14
     <div>
15 15
       {% if paginator.next_page %}
16 16
         <a class="prev" href="{{paginator.next_page}}">&larr; Older</a>
... ...
@@ -22,7 +22,7 @@ layout: default
22 22
     </div>
23 23
   </nav>
24 24
 </div>
25
-<aside role=sidebar>
25
+<aside class="sidebar">
26 26
   {% if site.blog_index_asides.size %}
27 27
     {% include_array blog_index_asides %}
28 28
   {% else %}
... ...
@@ -1,7 +1,7 @@
1 1
 function getNav() {
2
-  var mobileNav = $('nav[role=navigation] fieldset[role=site-search]').after('<fieldset role="mobile-nav"></fieldset>').next().append('<select></select>');
2
+  var mobileNav = $('nav[role=navigation] fieldset[role=search]').after('<fieldset class="mobile-nav"></fieldset>').next().append('<select></select>');
3 3
   mobileNav.children('select').append('<option value="">Navigate&hellip;</option>');
4
-  $('ul[role=main-navigation] a').each(function(link) {
4
+  $('ul.main-navigation a').each(function(link) {
5 5
     mobileNav.children('select').append('<option value="'+link.href+'">&bull; '+link.text+'</option>');
6 6
   });
7 7
   mobileNav.children('select').bind('change', function(event) {
... ...
@@ -19,7 +19,7 @@ function addSidebarToggler() {
19 19
       $('body').addClass('collapse-sidebar');
20 20
     }
21 21
   });
22
-  var sections = $('aside[role=sidebar] > section');
22
+  var sections = $('aside.sidebar > section');
23 23
   if (sections.length > 1) {
24 24
     sections.each(function(section, index){
25 25
       if ((sections.length >= 3) && index % 3 === 0) {
... ...
@@ -29,7 +29,7 @@ function addSidebarToggler() {
29 29
       $(section).addClass(count);
30 30
     });
31 31
   }
32
-  if (sections.length >= 3){ $('aside[role=sidebar]').addClass('thirds'); }
32
+  if (sections.length >= 3){ $('aside.sidebar').addClass('thirds'); }
33 33
 }
34 34
 
35 35
 function testFeatures() {