Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 054fbb9

Browse files
committed
fix(useModalManager): remove modal-open class when composable is disposed fixes bootstrap-vue-next#1166
1 parent 3310344 commit 054fbb9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/bootstrap-vue-next/src/composables/useModalManager.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import {createSharedComposable, getSSRHandler, unrefElement, useCounter} from '@vueuse/core'
1+
import {
2+
createSharedComposable,
3+
getSSRHandler,
4+
tryOnScopeDispose,
5+
unrefElement,
6+
useCounter,
7+
} from '@vueuse/core'
28
import {type Ref, watch} from 'vue'
39

410
const MODAL_OPEN_CLASS_NAME = 'modal-open'
@@ -20,6 +26,10 @@ const useSharedModalCounter = createSharedComposable(() => {
2026
}
2127
})
2228

29+
tryOnScopeDispose(() => {
30+
updateHTMLAttrs('body', 'class', '')
31+
})
32+
2333
watch(count, (newValue) => {
2434
updateHTMLAttrs('body', 'class', newValue > 0 ? MODAL_OPEN_CLASS_NAME : '')
2535
})

0 commit comments

Comments
 (0)