Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/gambitph/Stackable into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
Benjamin Intal authored and Benjamin Intal committed Aug 14, 2023
2 parents 41c5a5b + c03f1a9 commit 80d89c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/block/accordion/frontend-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ class StackableAccordion {
adjacent = adjacent.previousElementSibling
}
}

// If an accordion with large content is closed while opening
// another accordion, it scrolls downwards.
// This is to instantly scroll to the opening accordion.
if ( el.open ) {
const isAboveView = el.getBoundingClientRect().top < 0
if ( isAboveView ) {
el.scrollIntoView( {
inline: 'start',
block: 'start',
behavior: 'instant',
} )
}
}
} )
} )

Expand Down
4 changes: 2 additions & 2 deletions src/block/carousel/frontend-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class _StackableCarousel {
}

// Mousewheel left and right should scroll the fade carousel
this.sliderEl.addEventListener( 'wheel', this.onWheel )
this.sliderEl.addEventListener( 'wheel', this.onWheel, { passive: true } )

// Dragging
this.sliderEl.addEventListener( 'mousedown', this.dragMouseDown )
this.sliderEl.addEventListener( 'touchstart', this.dragTouchStart )
this.sliderEl.addEventListener( 'touchstart', this.dragTouchStart, { passive: true } )
this.sliderEl.addEventListener( 'scroll', this.onScroll )

// Autoplay
Expand Down

0 comments on commit 80d89c6

Please sign in to comment.