Skip to content

Commit

Permalink
Merge pull request #5025 from nextcloud-libraries/feat/modal-return-f…
Browse files Browse the repository at this point in the history
…ocus

feat(NcModal): Set return focus element on focus trap deactivation
  • Loading branch information
Pytal committed Jan 4, 2024
2 parents 920f6b7 + 74edf1c commit d224092
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/NcModal/NcModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ export default {
type: Boolean,
default: undefined,
},
/**
* Set element to return focus to after focus trap deactivation
*
* @type {import('focus-trap').FocusTargetValueOrFalse}
*/
setReturnFocus: {
default: undefined,
type: [HTMLElement, SVGElement, String, Boolean],
},
},
emits: [
Expand Down Expand Up @@ -779,6 +789,7 @@ export default {
// Esc can be used without stop in content or additionalTrapElements where it should not deacxtivate modal's focus trap.
// Focus trap is deactivated on modal close anyway.
escapeDeactivates: false,
setReturnFocus: this.setReturnFocus,
}
// Init focus trap
Expand Down

0 comments on commit d224092

Please sign in to comment.