FocusLock

Primitive #29

🔍 Problem it solves

When a critical modal is open, focus must never leave – not even by clicking outside, using Tab, or programmatic attempts. FocusLock provides an unbreakable focus trap.

✅ Solution

lockFocus(container) intercepts focusin and mousedown events, redirecting focus back to the container. Returns a cleanup function.

🧩 Used by components

CriticalModal, PaymentDialog, SecurityPinInput, EmergencyOverlay

🎮 Interactive demo