Skip to content

Commit a2de636

Browse files
juliusknorrPVince81
authored andcommitted
Allow to add additional trap elements to the focus trap
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 9a77bdd commit a2de636

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/components/Modal/Modal.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,14 @@ export default {
370370
type: String,
371371
default: 'body',
372372
},
373+
374+
/**
375+
* Additional elements to add to the focus trap
376+
*/
377+
additionalTrapElements: {
378+
type: Array,
379+
default: () => [],
380+
},
373381
},
374382
375383
data() {
@@ -416,6 +424,12 @@ export default {
416424
}
417425
}
418426
},
427+
additionalTrapElements(elements) {
428+
if (this.focusTrap) {
429+
const contentContainer = this.$refs.mask
430+
this.focusTrap.updateContainerElements([contentContainer, ...elements])
431+
}
432+
},
419433
},
420434
421435
beforeMount() {

0 commit comments

Comments
 (0)