1.0.9 • Published 4 years ago

a11yarrows v1.0.9

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

a11yarrows

Enable keyboard arrow navigation on focusable elements - View example

Install

a11yarrows can be installed via NPM:

$ npm install a11yarrows --save

or by direct script include:

<script src="{path_to_scripts}/a11yarrows.js">

Initialize

At minimum, a11yarrows requires a target HTML element to be defined and passed into the a11yarrows function call. The target element should be a container element that wraps your list.

let target = document.querySelector('#a11y-list');

There is also an optional options object that can modify default parameters.

a11yarrows.init(target, options);

Initialize as ES6 Module:

import * as a11yarrows from "a11yarrows";

let target = document.querySelector("#a11y-list");
a11yarrows.init(target, {
	// options
	selector: "li",
});

Initialize with Vanilla JS:

let target = document.querySelector("#a11y-list");
a11yarrows.init(target, {
	// options
	selector: ".item",
});

Options

a11yarrows accept a number of configuration parameters:

OptionDescription
selectorThe target child elements to recieve focus. default 'a'
loopUser will loop through the choices. default true
eventJavaScript EventListener. default 'keydown'
nextKeyboard key to move to next element. default 'down right'
prevKeyboard key to move to previous element. default 'up left'

License

a11yarrows is released under the MIT license.

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago