Skip to content

Commit 49f8f23

Browse files
patrickhlaukeJohann-S
authored andcommitted
Set touch-action to "none"
Firefox currently seems extremely fickle - with `pan-y` if fires pointercancel as soon as a touch strays even a pixel or so vertically. While `touch-action: pan-y` would be ideal (allowing users to scroll the page even when their finger started the scroll on the carousel), this prevents a swipe that isn't perfectly/only horizontal to be recognised by Firefox.
1 parent 2098595 commit 49f8f23

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

js/tests/unit/carousel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $(function () {
1919

2020
var stylesCarousel = [
2121
'<style>',
22-
' .carousel.pointer-event { -ms-touch-action: pan-y pinch-zoom; touch-action: pan-y pinch-zoom; }',
22+
' .carousel.pointer-event { -ms-touch-action: none; touch-action: none; }',
2323
'</style>'
2424
].join('')
2525

scss/_carousel.scss

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
// Notes on the classes:
22
//
3-
// 1. The .carousel-item-left and .carousel-item-right is used to indicate where
3+
// 1. .carousel.pointer-event should ideally be pan-y (to allow for users to scroll vertically)
4+
// even when their scroll action started on a carousel, but for compatibility (with Firefox)
5+
// we're preventing all actions instead
6+
// 2. The .carousel-item-left and .carousel-item-right is used to indicate where
47
// the active slide is heading.
5-
// 2. .active.carousel-item is the current slide.
6-
// 3. .active.carousel-item-left and .active.carousel-item-right is the current
8+
// 3. .active.carousel-item is the current slide.
9+
// 4. .active.carousel-item-left and .active.carousel-item-right is the current
710
// slide in its in-transition state. Only one of these occurs at a time.
8-
// 4. .carousel-item-next.carousel-item-left and .carousel-item-prev.carousel-item-right
11+
// 5. .carousel-item-next.carousel-item-left and .carousel-item-prev.carousel-item-right
912
// is the upcoming slide in transition.
1013

1114
.carousel {
1215
position: relative;
1316
}
1417

1518
.carousel.pointer-event {
16-
touch-action: pan-y pinch-zoom;
19+
touch-action: none;
1720
}
1821

1922
.carousel-inner {

0 commit comments

Comments
 (0)