npm.io
1.2.0 • Published 5 years ago

@riot-material/focus-manager

Licence
MIT
Version
1.2.0
Deps
0
Size
31 kB
Vulns
0
Weekly
0

focus manager for riot-material

Installation

You can install it via nodejs

npm install @riot-material/focus-manager

or download one of the bundled file

/**
 * `dist/index.amd.js`
 * `dist/index.umd.js`
 */
requirejs.config({
  paths: {
    "@riot-material/focus-manager": "path/to/@riot-material/focus-manager",
  },
});

require(['@riot-material/focus-manager'], function (focusManager) {
    // ...
});

/**
 * `dist/index.js`
 */
import * as focusManager from "@riot-material/focus-manager";

// or

import { ... } from "@riot-material/focus-manager";

otherwise you can include the script in your project html

<script src="@riot-material/focus-manager/index.umd.js" />

and access it via

window.riotMaterial.focusManager;

Methods

hold(options?: IOptions): void
release(): void
on<T extends keyof IManageableEvent`>(type: T, listener: (event: HTMLElementEventMap[T]) => void): void

Interfaces

IOptions

element?: HTMLElement onFocusInside?: (element: Element) => boolean if returns true the focus is kept to the element and hold back when it blurs away onFocusOutside?: (element: Element) => boolean if returns true the focus-manager is released onPrevious?: () => void onNext?: () => void

IManageableEvent

"keydown": KeyboardEvent "keyup": KeyboardEvent