Skip to content

Commit

Permalink
keyboard shortcut for / to go to search box. and autofocus to begin with
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Jan 18, 2012
1 parent 7d4c0a9 commit bba7e0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion js/script.js
Expand Up @@ -47,4 +47,10 @@ if(window.location.hash) {
search.value = hash;
featureList.search(hash);
updatesearch();
}
}

// keyboard shortcut for / to go to search box.
addEventListener('keyup', function(e){
if (e.which == 191 && document.activeElement != search)
search.focus();
});
3 changes: 2 additions & 1 deletion template.html
Expand Up @@ -19,7 +19,8 @@ <h2>
Look up properties and see if it is ready for use, and if so how you should use it with a polyfill, a fallback value or as it is.
</h2>
<div>
<input id=livesearch class=search name=livesearch placeholder='type to filter' type='search' value='' />
<input id=livesearch class=search name=livesearch placeholder='type to filter' type='search' value='' autofocus
/>
<a href="/" id=searchurl>link to this search ›</a>
</div>
</header>
Expand Down

0 comments on commit bba7e0e

Please sign in to comment.