diff --git a/js/carousel.js b/js/carousel.js index 4e4e47797d..82106d278a 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -42,6 +42,7 @@ } Carousel.prototype.keydown = function (e) { + if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index 6f0b9642fc..5998abe6af 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -478,6 +478,48 @@ $(function () { strictEqual($template.find('.item')[0], $template.find('.active')[0], 'first item still active after left arrow press') }) + test('should ignore keyboard events within s and ' + + '' + + '
' + + '' + + '
' + + '
' + + '' + + '
' + + '' + + '' + var $template = $(templateHTML) + var $input = $template.find('#in-put') + var $textarea = $template.find('#text-area') + + strictEqual($input.length, 1, 'found ') + strictEqual($textarea.length, 1, 'found