@3mo/focus-controller
v1.2.2
Published
A Lit controller for focus within its host, telling whether it came from a pointer, the keyboard or script.
Readme
Focus Controller
A Lit controller for focus within its host, telling whether it came from a pointer, the keyboard or script.
Installation
npm install @3mo/focus-controllerimport { FocusController } from '@3mo/focus-controller'Examples
- Default — Tab into the box, or click into it, and out again: the focus is reported as bubbled from a descendant, by keyboard or by pointer.
- Focused Itself — A host which takes the focus itself reports it as not bubbled.
- Programmatic — Focus moved by
focus()rather than by the user is reported asprogrammatic.
API
Exports
| Name | Kind | Description |
| --- | --- | --- |
| FocusController | class | Tracks whether the focus is within the host, and whether a pointer, the keyboard or a script put it there. |
Links
License
MIT © 3MO GmbH
