Skip to content

Commit

Permalink
fix(navigation): prevent hide on click when clicking on navigation bu…
Browse files Browse the repository at this point in the history
…ttons

fixes #7559
  • Loading branch information
nolimits4web committed May 30, 2024
1 parent 39a3e53 commit c0f7bb6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/modules/navigation/navigation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,15 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
nextEl = makeElementsArray(nextEl);
prevEl = makeElementsArray(prevEl);
const targetEl = e.target;
if (
swiper.params.navigation.hideOnClick &&
!prevEl.includes(targetEl) &&
!nextEl.includes(targetEl)
) {
let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl);

if (swiper.isElement && !targetIsButton) {
const path = e.path || (e.composedPath && e.composedPath());
if (path) {
targetIsButton = path.find((pathEl) => nextEl.includes(pathEl) || prevEl.includes(pathEl));
}
}
if (swiper.params.navigation.hideOnClick && !targetIsButton) {
if (
swiper.pagination &&
swiper.params.pagination &&
Expand Down

0 comments on commit c0f7bb6

Please sign in to comment.