Skip to content

Commit

Permalink
Adding test to ensure keyboard navigation is not triggered if focused…
Browse files Browse the repository at this point in the history
… on form elements
  • Loading branch information
getdave committed Sep 20, 2011
1 parent 8877958 commit b322839
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -41,6 +41,7 @@
</ul>
</div>


</body>

</html>
6 changes: 4 additions & 2 deletions protoshow.js
Expand Up @@ -502,9 +502,11 @@ var protoShow = Class.create({

var _this = this;
document.observe('keydown', function(key) {

var keyCode = key.keyCode;

if (keyCode === 37 || keyCode === 39) {

// stop arrow keys from working when focused on form items
if ( (!key.target.tagName.match('TEXTAREA|INPUT|SELECT')) && (keyCode === 37 || keyCode === 39) ) {
if (keyCode === 37) {
_this.previous();
} else if (keyCode === 39) {
Expand Down

0 comments on commit b322839

Please sign in to comment.