Skip to content

Commit

Permalink
fix(NcModal): deactivate other focus trap when modal is opened
Browse files Browse the repository at this point in the history
[wip]
[skip ci]

Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Jul 5, 2024
1 parent e6b8b2d commit 8023e46
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/NcModal/NcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,10 @@ export default {
setReturnFocus: this.setReturnFocus,
}

this.externalFocusTrapStack = [...getTrapStack()]
for (const trap of this.externalFocusTrapStack) {
trap.deactivate()
}
// Init focus trap
this.focusTrap = createFocusTrap([contentContainer, ...this.additionalTrapElements], options)
this.focusTrap.activate()
Expand All @@ -809,6 +813,9 @@ export default {
}
this.focusTrap?.deactivate()
this.focusTrap = null
for (const trap of this.externalFocusTrapStack) {
trap.activate()
}
},

},
Expand Down

0 comments on commit 8023e46

Please sign in to comment.