
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@nextcloud/focus-trap
Advanced tools
Wrapper over [`focus-trap`](https://github.com/focus-trap/focus-trap) library to have more than one instance activate at the same time.
Wrapper over focus-trap library to have more than one instance activate at the same time.
npm install @nextcloud/focus-trap -S
yarn add @nextcloud/focus-trap
The API is the same of focus-trap, just follow the doc.
import { createFocusTrap } from '@nextcloud/focus-trap';
Check src/ to full example.
import type { ComputedRef, Ref } from 'vue';
import type { FocusTrap } from '@nextcloud/focus-trap';
import { watchEffect, onBeforeUnmount } from 'vue';
import { createFocusTrap } from '@nextcloud/focus-trap';
type Input = ComputedRef<boolean> | Ref<boolean>;
const useFocusTrap = (state: Input, el: Ref<HTMLElement | null>): void => {
let focusTrap: FocusTrap | null = null;
const onOpen = (): void => {
if (el.value == null) {
return;
}
focusTrap = createFocusTrap(el.value, {
escapeDeactivates: false,
allowOutsideClick: true,
});
focusTrap.activate();
};
const onClose = (): void => {
if (focusTrap == null) {
return;
}
focusTrap.deactivate();
focusTrap = null;
};
watchEffect(() => {
state.value
? requestAnimationFrame(onOpen)
: requestAnimationFrame(onClose);
});
onBeforeUnmount(onClose);
};
export { useFocusTrap };
This project is build on top of
npm install
# test single run
npm run test
# test with coverage
npm run test -- --coverage
# watch tests and code changes
npm run test:watch
npm run dev
# apply prettier
npm run format
# run eslint
npm run lint
# apply fix to eslint errors
npm run lint:fix
# check lint and format
npm run check
FAQs
Wrapper over [`focus-trap`](https://github.com/focus-trap/focus-trap) library to have more than one instance activate at the same time.
We found that @nextcloud/focus-trap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.