-
-
Notifications
You must be signed in to change notification settings - Fork 78.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Carousel: Only prevents default for ARROW_LEFT and ARROW_RIGHT keys #20907
Carousel: Only prevents default for ARROW_LEFT and ARROW_RIGHT keys #20907
Conversation
Fixes 2 bugs: 1. All keydowns were being prevented. Because of that the user wasn't able to navigate in the whole page using ARROW_UP/ARROW_DOWN. 2. Even when is an input or textarea the keydowns were being prevented. Because of that the user wasn't able to type any text on these elements.
|
||
$template.trigger(eventArrowDown) | ||
|
||
$template.one('keydown', function (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function expression prefer-arrow-callback
|
||
$template.trigger(eventArrowDown) | ||
|
||
$template.one('keydown', function (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function expression prefer-arrow-callback
var eventArrowDown = $.Event('keydown', { which: 40 }) | ||
var eventArrowUp = $.Event('keydown', { which: 38 }) | ||
|
||
$template.one('keydown', function (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function expression prefer-arrow-callback
var eventArrowDown = $.Event('keydown', { which: 40 }) | ||
var eventArrowUp = $.Event('keydown', { which: 38 }) | ||
|
||
$template.one('keydown', function (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function expression prefer-arrow-callback
var done = assert.async() | ||
|
||
var eventArrowDown = $.Event('keydown', { which: 40 }) | ||
var eventArrowUp = $.Event('keydown', { which: 38 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
var done = assert.async() | ||
|
||
var eventArrowDown = $.Event('keydown', { which: 40 }) | ||
var eventArrowUp = $.Event('keydown', { which: 38 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
$template.bootstrapCarousel() | ||
var done = assert.async() | ||
|
||
var eventArrowDown = $.Event('keydown', { which: 40 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
$template.bootstrapCarousel() | ||
var done = assert.async() | ||
|
||
var eventArrowDown = $.Event('keydown', { which: 40 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
var $template = $(templateHTML) | ||
|
||
$template.bootstrapCarousel() | ||
var done = assert.async() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
var $template = $(templateHTML) | ||
|
||
$template.bootstrapCarousel() | ||
var done = assert.async() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
+ '</div>' | ||
+ '</div>' | ||
+ '</div>' | ||
var $template = $(templateHTML) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
+ '</div>' | ||
+ '</div>' | ||
+ '</div>' | ||
var $template = $(templateHTML) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
@@ -507,6 +507,37 @@ $(function () { | |||
assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active') | |||
}) | |||
|
|||
QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) { | |||
assert.expect(2) | |||
var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
@@ -507,6 +507,37 @@ $(function () { | |||
assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active') | |||
}) | |||
|
|||
QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) { | |||
assert.expect(2) | |||
var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected var, use let or const instead no-var
@@ -507,6 +507,37 @@ $(function () { | |||
assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active') | |||
}) | |||
|
|||
QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) { | |||
assert.expect(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No magic number: 2 no-magic-numbers
@@ -507,6 +507,37 @@ $(function () { | |||
assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active') | |||
}) | |||
|
|||
QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) { | |||
assert.expect(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No magic number: 2 no-magic-numbers
@@ -507,6 +507,37 @@ $(function () { | |||
assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active') | |||
}) | |||
|
|||
QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'QUnit' is not defined no-undef
Unexpected function expression prefer-arrow-callback
@@ -507,6 +507,37 @@ $(function () { | |||
assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active') | |||
}) | |||
|
|||
QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'QUnit' is not defined no-undef
Unexpected function expression prefer-arrow-callback
Second bug fix already done : #19058 |
Fixes 2 bugs: