Skip to content

Commit 9173014

Browse files
committed
fix: fixed focusTrap
1 parent 04c7b30 commit 9173014

File tree

5 files changed

+3
-6
lines changed

5 files changed

+3
-6
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/vue-final-modal/src/components/CoreModal/CoreModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const {
8989
},
9090
onLeave() {
9191
deleteFromOpenedModals(getModalInstance())
92+
focusLast()
9293
resetZIndex()
9394
emitEvent('closed')
9495
resolveToggle('closed')
@@ -156,7 +157,6 @@ function close() {
156157
emitEvent('beforeClose')
157158
enableBodyScroll()
158159
deleteFromOpenedModalOverlays(modalInstance)
159-
focusLast()
160160
openLastOverlay()
161161
leaveTransition()
162162
}

packages/vue-final-modal/src/components/CoreModal/useFocusTrap.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { ComputedRef, Ref } from 'vue'
2-
import { nextTick } from 'vue'
32
import { useFocusTrap as _useFocusTrap } from '@vueuse/integrations/useFocusTrap'
43
import type CoreModal from './CoreModal.vue'
54
import type { Modal } from '~/Modal'
@@ -32,10 +31,8 @@ export function useFocusTrap(
3231
// If there are still nested modals opened, focus the last opened modal
3332
if (openedModals.length <= 0)
3433
return
35-
nextTick(() => {
36-
const modal = openedModals[openedModals.length - 1]
37-
modal?.value.focus()
38-
})
34+
const modal = openedModals[openedModals.length - 1]
35+
modal?.value.focus()
3936
}
4037

4138
function blur() {

0 commit comments

Comments
 (0)