Skip to content

Commit

Permalink
Allow to add additional trap elements to the focus trap
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Aug 12, 2022
1 parent 303e07b commit 98098ff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 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

0 comments on commit 98098ff

Please sign in to comment.