
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
@valu/focus-trap
Advanced tools
Like [davidtheclark/focus-trap][] but can trap focus to multiple containers.
Like davidtheclark/focus-trap but can trap focus to multiple containers.
See demos here http://valu-focus-trap.netlify.com
npm install @valu/focus-trap
import { FocusTrap } from "@valu/focus-trap";
const trap = new FocusTrap({
containers: document.querySelectorAll(".container"),
});
trap.enable();
document.querySelector("button#disable").addEventListener(() => {
trap.disable();
});
The FocusTrap
constructor takes following options object
interface FocusTrapOptions {
containers: HTMLElement | HTMLElement[] | NodeList | null | undefined;
/**
* Disable the trap when user click an element outside of the selected
* containers
*/
outsideClickDisables?: boolean;
/**
* Disable the trap when user hits escape key
*/
escDisables?: boolean;
/**
* Options to control aspects of the focusing process
*/
focusOptions?: FocusOptions;
/**
* Executed before trap enables
*/
onBeforeEnable?(trap: FocusTrap): void;
/**
* Executed after the trap has been enabled
*/
onBeforeDisable?(trap: FocusTrap): void;
/**
* Execute before the trap gets disabled
*/
onAfterEnable?(trap: FocusTrap): void;
/**
* Executed after the trap has been disabled. By default the focus trap
* restores focus to the element that had the focus before trap activation.
* This hook can used to focus some other element manually.
*/
onAfterDisable?(trap: FocusTrap): void;
/**
* Skip focusing given tabbable when returning false
*/
validateTabbable?(
tabbable: HTMLElement,
container: HTMLElement,
trap: FocusTrap,
): boolean;
}
FAQs
Like [davidtheclark/focus-trap][] but can trap focus to multiple containers.
We found that @valu/focus-trap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.