Skip to content

Commit

Permalink
Merge pull request jashkenas#3338 from danielnixon/master
Browse files Browse the repository at this point in the history
Fix a bunch of accessibility issues.
  • Loading branch information
akre54 committed Feb 20, 2015
2 parents 2ef7a42 + 3d2a8a2 commit ab9c571
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 62 deletions.
17 changes: 8 additions & 9 deletions examples/todos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<header>
<h1>Todos</h1>
<label class="sr-only" for="new-todo">What needs to be done?</label>
<input id="new-todo" type="text" placeholder="What needs to be done?">
</header>

Expand All @@ -23,16 +24,12 @@ <h1>Todos</h1>
</section>

<footer>
<a id="clear-completed">Clear completed</a>
<a href="#" id="clear-completed" role="button">Clear completed</a>
<div id="todo-count"></div>
</footer>

</div>

<div id="instructions">
Double-click to edit a todo.
</div>

<div id="credits">
Created by
<br />
Expand All @@ -51,16 +48,18 @@ <h1>Todos</h1>

<script type="text/template" id="item-template">
<div class="view">
<input class="toggle" type="checkbox" <%= done ? 'checked="checked"' : '' %> />
<label><%- title %></label>
<a class="destroy"></a>
<label>
<input class="toggle" type="checkbox" <%= done ? 'checked="checked"' : '' %> /><%- title %>
</label>
<a href="#" class="edit-link button" role="button">Edit</a>
<a href="#" class="destroy" role="button"><span class="sr-only">Delete</span></a>
</div>
<input class="edit" type="text" value="<%- title %>" />
</script>

<script type="text/template" id="stats-template">
<% if (done) { %>
<a id="clear-completed">Clear <%= done %> completed <%= done == 1 ? 'item' : 'items' %></a>
<a href="#" id="clear-completed" class="button" role="button">Clear <%= done %> completed <%= done == 1 ? 'item' : 'items' %></a>
<% } %>
<div class="todo-count"><b><%= remaining %></b> <%= remaining == 1 ? 'item' : 'items' %> left</div>
</script>
Expand Down
100 changes: 52 additions & 48 deletions examples/todos/todos.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,51 @@ body {
-webkit-font-smoothing: antialiased;
}

.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}

.button {
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
color: #555555;
font-size: 11px;
padding: 0 10px 1px;
cursor: pointer;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
-ms-border-radius: 12px;
-o-border-radius: 12px;
border-radius: 12px;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-ms-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
}

.button:hover {
background: rgba(0, 0, 0, 0.15);
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-ms-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
}

.button:active {
position: relative;
top: 1px;
}

#todoapp {
background: #fff;
padding: 20px;
Expand Down Expand Up @@ -68,7 +113,7 @@ body {
}

#todo-list li {
padding: 18px 20px 18px 0;
padding: 18px 70px 18px 0;
position: relative;
font-size: 24px;
border-bottom: 1px solid #cccccc;
Expand All @@ -87,19 +132,20 @@ body {
position: absolute;
right: 5px;
top: 20px;
display: none;
cursor: pointer;
width: 20px;
height: 20px;
background: url(destroy.png) no-repeat;
}

#todo-list li:hover .destroy {
display: block;
#todo-list .edit-link {
position: absolute;
right: 35px;
top: 20px;
}

#todo-list .destroy:hover {
background-position: 0 -20px;
#todo-list .destroy:hover, #todo-list .destroy:focus {
background-position: 0 -20px;
}

#todo-list li.editing {
Expand Down Expand Up @@ -149,56 +195,14 @@ body {

#clear-completed {
float: right;
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
color: #555555;
font-size: 11px;
margin-top: 8px;
margin-bottom: 8px;
padding: 0 10px 1px;
cursor: pointer;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
-ms-border-radius: 12px;
-o-border-radius: 12px;
border-radius: 12px;
-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-moz-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-ms-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 0 0;
}

#clear-completed:hover {
background: rgba(0, 0, 0, 0.15);
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-ms-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
-o-box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
box-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0 0;
}

#clear-completed:active {
position: relative;
top: 1px;
}

#todo-count span {
font-weight: bold;
}

#instructions {
margin: 10px auto;
color: #777777;
text-shadow: rgba(255, 255, 255, 0.8) 0 1px 0;
text-align: center;
}

#instructions a {
color: #336699;
}

#credits {
margin: 30px auto;
color: #999;
Expand Down
10 changes: 5 additions & 5 deletions examples/todos/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ $(function(){

// The DOM events specific to an item.
events: {
"click .toggle" : "toggleDone",
"dblclick .view" : "edit",
"click a.destroy" : "clear",
"keypress .edit" : "updateOnEnter",
"blur .edit" : "close"
"click .toggle" : "toggleDone",
"click a.edit-link" : "edit",
"click a.destroy" : "clear",
"keypress .edit" : "updateOnEnter",
"blur .edit" : "close"
},

// The TodoView listens for changes to its model, re-rendering. Since there's
Expand Down

0 comments on commit ab9c571

Please sign in to comment.