@nextcloud/vue
Version:
Nextcloud vue components
36 lines (35 loc) • 803 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 = [];
}
};
}
export {
createTrapStackController as c,
getTrapStack as g
};
//# sourceMappingURL=focusTrap-HJQ4pqHV.mjs.map