@nextcloud/vue
Version:
Nextcloud vue components
35 lines (34 loc) • 851 B
JavaScript
;
function getTrapStack() {
window._nc_focus_trap ??= [];
return window._nc_focus_trap;
}
function createTrapStackController() {
let pausedStack = [];
return {
/**
* Pause the current focus-trap stack
*/
pause() {
pausedStack = [...getTrapStack()];
for (const trap of pausedStack) {
trap.pause();
}
},
/**
* Unpause the paused focus trap stack
* If the actual stack is different from the paused one, ignore unpause.
*/
unpause() {
if (pausedStack.length === getTrapStack().length) {
for (const trap of pausedStack) {
trap.unpause();
}
}
pausedStack = [];
}
};
}
exports.createTrapStackController = createTrapStackController;
exports.getTrapStack = getTrapStack;
//# sourceMappingURL=focusTrap-DUTqW_IG.cjs.map