0.5.1 • Published 11 months ago

errokees v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

errokees

Errokees [ah-ro-ki:z] - Arrow key navigation and selection in browser.

This library exists because I needed to get the browser embedded into LG TV apps to allow easy navigation via remote. The remote emits arrow keys for navigation as well as <enter> key when OK is pressed.

With this library, you can assign a class to each HTML element you wish to allow the user to interact with. Further you can define a style that is assigned when an item is selected (navigated to).

When <enter> / OK is pressed, an item is "activated" meaning that the normal action is performed. Links and buttons are clicked. Input fields are focused and select lists are activated.

You can also provide custom events to be emitted when an item is selected or activated.

demo

To use the demo, run make demo. Use your arrow keys and <enter> key to navigate and select a collection of elements.

The demo uses the webpack development server, so you can hack on the code easily and test your changes in the demo.

usage

Usage is dead simple:

let ek = new Errokees();

// If for some reason you want to shut down the library:
ek.disable();

// The ek object is now useless.
delete ek

You can pass an options object, and override any of the defaults.

const defaults = {
  // keys...
  up: 'ArrowUp',
  down: 'ArrowDown',
  left: 'ArrowLeft',
  right: 'ArrowRight',
  activate: 'Enter',

  // css classes
  selectableClass: 'errokees-selectable',
  selectedClass: 'errokees-selected',

  // origin (select item by default)
  origin: 'right',
  keyEventName: 'keydown',
  selectEventName: null,
  activateEventName: null,
}

See the demo/ directory for an example of usage.

development

A Makefile is used for all common actions. Simply do make build or make clean etc.

0.4.5

11 months ago

0.4.4

11 months ago

0.4.6

11 months ago

0.5.0

11 months ago

0.4.3

11 months ago

0.5.1

11 months ago

0.4.2

11 months ago

0.2.12

12 months ago

0.2.11

12 months ago

0.2.10

12 months ago

0.2.9

12 months ago

0.4.1

11 months ago

0.4.0

11 months ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago