Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/components/Modal/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,14 @@ export default {
type: Boolean,
default: true,
},

/**
* Additional elements to add to the focus trap
*/
additionalTrapElements: {
type: Array,
default: () => [],
},
},

emits: [
Expand Down Expand Up @@ -505,6 +513,12 @@ export default {
}
}
},
additionalTrapElements(elements) {
if (this.focusTrap) {
const contentContainer = this.$refs.mask
this.focusTrap.updateContainerElements([contentContainer, ...elements])
}
},
},

beforeMount() {
Expand Down Expand Up @@ -661,7 +675,9 @@ export default {
const contentContainer = this.$refs.mask
// wait until all children are mounted and available in the DOM before focusTrap can be added
this.$nextTick(() => {
this.focusTrap = createFocusTrap(contentContainer)
this.focusTrap = createFocusTrap(contentContainer, {
allowOutsideClick: true,
})
this.focusTrap.activate()
})
},
Expand Down