@chialab/loock
v4.6.3
Published
Keyboard navigation for Web Apps and Components.
Readme
Loock
Keyboard navigation for Web Apps and Components.
Features
Loock provides a set of behaviors to manage focus and keyboard navigation for web apps and components.
Navigation areas
Organize your web page or web application by navigation areas.
Persistent context
Never lose the context while navigating the area with the TAB key.
Escape hatch
Leave the context with the ESC key.
Get the library
Install via NPM:
npm install @chialab/loockyarn add @chialab/loockpnpm add @chialab/loockCDN
Load via esm.run:
import { focusTrapBehavior } from 'https://esm.run/@chialab/loock';Usage
import { focusTrapBehavior } from '@chialab/loock';
const dialog = document.getElementById('.dialog');
const trap = focusTrapBehavior(dialog, {
inert: true,
});
dialog.addEventListener('open', () => {
trap.connect();
});Development
Build
Install the dependencies and run the build script:
pnpm installpnpm buildThis will generate the bundles in the dist folder, as well as the declaration files.
Test
Run the test script:
pnpm testLicense
Loock is released under the MIT license.
