Skip to content

Commit

Permalink
fix vertical swipe navigation not blocking page scrolling in embedded…
Browse files Browse the repository at this point in the history
… decks
  • Loading branch information
hakimel committed Mar 19, 2024
1 parent d4e5c39 commit 924bdb6
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 6 deletions.
7 changes: 6 additions & 1 deletion css/reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -631,11 +631,16 @@ $controlsArrowAngleActive: 36deg;
touch-action: pinch-zoom;
}

// Swiping on an embedded deck should not block page scrolling
// Swiping on an embedded deck should not block page scrolling...
.reveal.embedded {
touch-action: pan-y;
}

// ... unless we're on a vertical slide
.reveal.embedded.is-vertical-slide {
touch-action: none;
}

.reveal .slides {
position: absolute;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion dist/reveal.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions js/controllers/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export default class Touch {
*/
onTouchStart( event ) {

this.touchCaptured = false;

if( this.isSwipePrevented( event.target ) ) return true;

this.touchStartX = event.touches[0].clientX;
Expand Down
3 changes: 3 additions & 0 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,9 @@ export default function( revealElement, options ) {
let currentHorizontalSlide = horizontalSlides[ indexh ],
currentVerticalSlides = currentHorizontalSlide.querySelectorAll( 'section' );

// Indicate when we're on a vertical slide
revealElement.classList.toggle( 'is-vertical-slide', currentVerticalSlides.length > 1 );

// Store references to the previous and current slides
currentSlide = currentVerticalSlides[ indexv ] || currentHorizontalSlide;

Expand Down

0 comments on commit 924bdb6

Please sign in to comment.