Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a9a2e8a

Browse files
feat: replace body-scroll-lock with scroll-lock #403
1 parent cbd2766 commit a9a2e8a

File tree

6 files changed

+134
-360
lines changed

6 files changed

+134
-360
lines changed

‎packages/vue-final-modal/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@
3535
"devDependencies": {
3636
"@cypress/vue": "^5.0.5",
3737
"@release-it/conventional-changelog": "^5.1.1",
38+
"@types/scroll-lock": "^2.1.3",
3839
"@vueuse/core": "^10.7.1",
3940
"@vueuse/integrations": "^10.7.1",
4041
"cypress": "^13.6.0",
4142
"focus-trap": "^7.5.4",
4243
"release-it": "^16.1.3",
44+
"scroll-lock": "^2.1.5",
4345
"vite-plugin-dts": "^3.6.3",
4446
"vue": "^3.4.7"
4547
},
4648
"peerDependencies": {
49+
"@vue/composition-api": "^1.0.0-rc.1",
4750
"@vueuse/core": ">=10.0.0",
4851
"@vueuse/integrations": ">=10.0.0",
4952
"focus-trap": ">=7.2.0",
50-
"@vue/composition-api": "^1.0.0-rc.1",
53+
"scroll-lock": ">=2.1.5",
5154
"vue": ">=2.7.0 || >=3.0.0"
5255
},
5356
"homepage": "https://vue-final-modal.org/",

‎packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useTransition } from './useTransition'
55
import { useToClose } from './useToClose'
66
import { useModelValue } from './useModelValue'
77
import { useFocusTrap } from './useFocusTrap'
8-
import { useLockScroll } from './useBodyScrollLock'
8+
import { useScrollLock } from './useScrollLock'
99
import { useZIndex } from './useZIndex'
1010
import { vVisible } from './vVisible'
1111
import { arrayMoveItemToLast, arrayRemoveItem, noop, once } from '~/utils'
@@ -50,7 +50,7 @@ const vfmContentEl = ref<HTMLDivElement>()
5050
const { focus, blur } = useFocusTrap(props, { focusEl: vfmRootEl })
5151
const { zIndex, refreshZIndex, resetZIndex } = useZIndex(props)
5252
const { modelValueLocal } = useModelValue(props, emit, { open, close })
53-
const { enableBodyScroll, disableBodyScroll } = useLockScroll(props, {
53+
const { disablePageScroll, enablePageScroll } = useScrollLock(props, {
5454
lockScrollEl: vfmRootEl,
5555
modelValueLocal,
5656
})
@@ -74,7 +74,7 @@ const {
7474
modelValueLocal,
7575
onEntering() {
7676
nextTick(() => {
77-
disableBodyScroll()
77+
disablePageScroll()
7878
focus()
7979
})
8080
},
@@ -87,7 +87,7 @@ const {
8787
onLeave() {
8888
arrayRemoveItem(openedModals, instance)
8989
resetZIndex()
90-
enableBodyScroll()
90+
enablePageScroll()
9191
emit('closed')
9292
// eslint-disable-next-line vue/custom-event-name-casing
9393
emit('_closed')
@@ -143,7 +143,7 @@ function close(): boolean {
143143
}
144144
145145
onBeforeUnmount(() => {
146-
enableBodyScroll()
146+
enablePageScroll()
147147
arrayRemoveItem(modals, instance)
148148
arrayRemoveItem(openedModals, instance)
149149
blur()
@@ -208,6 +208,7 @@ export default {
208208
:style="{ zIndex }"
209209
role="dialog"
210210
aria-modal="true"
211+
data-scroll-lock-scrollable
211212
@keydown.esc="() => onEsc()"
212213
@mouseup.self="() => onMouseupRoot()"
213214
@mousedown.self="e => onMousedown(e)"

‎packages/vue-final-modal/src/components/VueFinalModal/useBodyScrollLock.ts

Lines changed: 0 additions & 282 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /