A simple TypeScript npm package to lock focus within a specified container. This package helps ensure that keyboard navigation stays within a particular section of a webpage, improving accessibility and user experience.
To install the focus-trap-improved
package, use npm:
npm install focus-trap-improved
Simple import the package:
import FocusTrapImproved from "focus-trap-improved"
Add this line to either an eventlistener or a function
new FocusLocker();
add the class focus-trap
to the element and thats it!