From f979ff68e90693e6c15f30f92b2da779a758c88a Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 29 Oct 2024 15:39:27 +0100 Subject: [PATCH] fix bug where hiding all except 1 slide in a stack caused controls to break --- js/controllers/controls.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/controllers/controls.js b/js/controllers/controls.js index 3d150dabd03..1ab60d0c77c 100644 --- a/js/controllers/controls.js +++ b/js/controllers/controls.js @@ -146,9 +146,14 @@ export default class Controls { if( fragmentsRoutes.prev ) this.controlsPrev.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } ); if( fragmentsRoutes.next ) this.controlsNext.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } ); + const isVerticalStack = this.Reveal.isVerticalSlide( currentSlide ); + const hasVerticalSiblings = isVerticalStack && + currentSlide.parentElement && + currentSlide.parentElement.querySelectorAll( ':scope > section' ).length > 1; + // Apply fragment decorators to directional buttons based on // what slide axis they are in - if( this.Reveal.isVerticalSlide( currentSlide ) ) { + if( isVerticalStack && hasVerticalSiblings ) { if( fragmentsRoutes.prev ) this.controlsUp.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } ); if( fragmentsRoutes.next ) this.controlsDown.forEach( el => { el.classList.add( 'fragmented', 'enabled' ); el.removeAttribute( 'disabled' ); } ); }