Trappies
Trappies
is an alternative, lightweigth solution (see also focus-trap) to trap focus within certian container or list of elements.
Written is ES6, to use with older browser please use tools like Babel
or other of your choice.
Usage
const Trappies = ;const traps = ; traps; traps; // activates trap, allowing to only navigate within `.modal` containertraps; // to deactivate trap, use `release` methodtraps; // activating another trap will lead to releaseing currently active, restoring the state before activation// queueing is not implemented at this point, but PRs welcome!traps;