Skip to content
Permalink
Browse files
fix(carousel): disable the next/prev controls when the carousel is sl…
…iding (closes #4210) (#4212)
  • Loading branch information
tmorehouse committed Oct 7, 2019
1 parent 7e4f160 commit 64d556d452ed8feefdb56a7f40ceb9a08b5e617f
Showing with 32 additions and 14 deletions.
  1. +32 −14 src/components/carousel/carousel.js
@@ -498,19 +498,36 @@ export const BCarousel = /*#__PURE__*/ Vue.extend({
// Prev and next controls
let controls = h()
if (this.controls) {
const prevHandler = evt => {
/* istanbul ignore next */
if (!this.isSliding) {
this.handleClick(evt, this.prev)
} else {
evt.preventDefault()
}
}
const nextHandler = evt => {
/* istanbul ignore next */
if (!this.isSliding) {
this.handleClick(evt, this.next)
} else {
evt.preventDefault()
}
}
controls = [
h(
'a',
{
class: ['carousel-control-prev'],
attrs: { href: '#', role: 'button', 'aria-controls': this.safeId('__BV_inner_') },
attrs: {
href: '#',
role: 'button',
'aria-controls': this.safeId('__BV_inner_'),
'aria-disabled': this.isSliding ? 'true' : null
},
on: {
click: evt => {
this.handleClick(evt, this.prev)
},
keydown: evt => {
this.handleClick(evt, this.prev)
}
click: prevHandler,
keydown: prevHandler
}
},
[
@@ -522,14 +539,15 @@ export const BCarousel = /*#__PURE__*/ Vue.extend({
'a',
{
class: ['carousel-control-next'],
attrs: { href: '#', role: 'button', 'aria-controls': this.safeId('__BV_inner_') },
attrs: {
href: '#',
role: 'button',
'aria-controls': this.safeId('__BV_inner_'),
'aria-disabled': this.isSliding ? 'true' : null
},
on: {
click: evt => {
this.handleClick(evt, this.next)
},
keydown: evt => {
this.handleClick(evt, this.next)
}
click: nextHandler,
keydown: nextHandler
}
},
[

0 comments on commit 64d556d

Please sign in to comment.