Skip to content

Commit aae15c7

Browse files
committed
fix: prevent Twoslash poppers from persisting between slides
1 parent e59e631 commit aae15c7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/client/composables/useNav.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { slides } from '#slidev/slides'
55
import { clamp } from '@antfu/utils'
66
import { parseRangeString } from '@slidev/parser/utils'
77
import { createSharedComposable } from '@vueuse/core'
8+
import { hideAllPoppers } from 'floating-vue'
89
import { computed, ref, watch } from 'vue'
910
import { useRoute, useRouter } from 'vue-router'
1011
import { CLICKS_MAX } from '../constants'
@@ -118,6 +119,8 @@ export function useNavBase(
118119

119120
watch(currentSlideRoute, (next, prev) => {
120121
navDirection.value = next.no - prev.no
122+
if (prev)
123+
hideAllPoppers()
121124
})
122125

123126
async function openInEditor(url?: string) {

packages/client/internals/SlidesShow.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function onAfterLeave() {
8787
>
8888
<template v-for="route of loadedRoutes" :key="route.no">
8989
<SlideWrapper
90+
v-if="route === currentSlideRoute || isPrintMode"
9091
v-show="route === currentSlideRoute"
9192
:clicks-context="isPrintMode && !isPrintWithClicks ? createFixedClicks(route, CLICKS_MAX) : getPrimaryClicks(route)"
9293
:route="route"

0 commit comments

Comments
 (0)