Skip to content
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

Merged

Conversation

matheusazzi
Copy link
Contributor

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.

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) {

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) {

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) {

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) {

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 })

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 })

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 })

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 })

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()

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()

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)

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)

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">'

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">'

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)

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)

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) {

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) {

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

@Johann-S
Copy link
Member

Second bug fix already done : #19058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants