Skip to content

Commit

Permalink
fix(NcModal): fix focus-trap fallback
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jun 25, 2023
1 parent a92a39e commit 648a4ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -61,7 +61,7 @@
"emoji-mart-vue-fast": "^15.0.0",
"escape-html": "^1.0.3",
"floating-vue": "^1.0.0-beta.19",
"focus-trap": "^7.1.0",
"focus-trap": "^7.4.3",
"linkify-string": "^4.0.0",
"md5": "^2.3.0",
"node-polyfill-webpack-plugin": "^2.0.1",
Expand Down
12 changes: 8 additions & 4 deletions src/components/NcModal/NcModal.vue
Expand Up @@ -180,7 +180,8 @@ export default {
role="dialog"
aria-modal="true"
:aria-labelledby="'modal-name-' + randId"
:aria-describedby="'modal-description-' + randId">
:aria-describedby="'modal-description-' + randId"
tabindex="-1">
<!-- Header -->
<transition name="fade-visibility" appear>
<div class="modal-header">
Expand Down Expand Up @@ -707,11 +708,14 @@ export default {
// wait until all children are mounted and available in the DOM before focusTrap can be added
await this.$nextTick()
// Init focus trap
this.focusTrap = createFocusTrap(contentContainer, {
const options = {
allowOutsideClick: true,
fallbackFocus: contentContainer,
trapStack: getTrapStack(),
})
}
// Init focus trap
this.focusTrap = createFocusTrap(contentContainer, options)
this.focusTrap.activate()
},
clearFocusTrap() {
Expand Down

0 comments on commit 648a4ba

Please sign in to comment.