Permalink
Browse files

Adding test to ensure keyboard navigation is not triggered if focused…

… on form elements
  • Loading branch information...
1 parent 8877958 commit b322839a9536b47a8a201a5489c3eca12c6ea918 @getdave committed Sep 20, 2011
Showing with 5 additions and 2 deletions.
  1. +1 −0 index.html
  2. +4 −2 protoshow.js
View
@@ -41,6 +41,7 @@
</ul>
</div>
+
</body>
</html>
View
@@ -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) {

0 comments on commit b322839

Please sign in to comment.