# @npm-polymer/iron-a11y-keys-behavior

> A behavior that enables keybindings for greater a11y.

Latest version **1.1.9** (published 2017-06-03) · http://polymer.github.io/LICENSE.txt license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @npm-polymer/iron-a11y-keys-behavior
pnpm add @npm-polymer/iron-a11y-keys-behavior
yarn add @npm-polymer/iron-a11y-keys-behavior
bun add @npm-polymer/iron-a11y-keys-behavior
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.9 |
| Published | 2017-06-03 |
| First published | 2017-06-03 |
| Weekly downloads | 0 |
| License | http://polymer.github.io/LICENSE.txt |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Maintainers | npm-polymer |
| Keywords | web-components, web-component, polymer, a11y, input |

## Links

- npm: https://www.npmjs.com/package/@npm-polymer/iron-a11y-keys-behavior
- Repository: https://github.com/PolymerElements/iron-a11y-keys-behavior
- Homepage: https://github.com/PolymerElements/iron-a11y-keys-behavior#readme
- Issues: https://github.com/PolymerElements/iron-a11y-keys-behavior/issues
- npm.io page: https://npm.io/package/@npm-polymer/iron-a11y-keys-behavior

## Dependencies (1)

- [@npm-polymer/polymer](https://npm.io/package/@npm-polymer/polymer.md) 2.0.1

## Recent versions

- 1.1.9 (latest) — 2017-06-03

## README

<!---

This README is automatically generated from the comments in these files:
iron-a11y-keys-behavior.html

Edit those files, and our readme bot will duplicate them over here!
Edit this file, and the bot will squash your changes :)

The bot does some handling of markdown. Please file a bug if it does the wrong
thing! https://github.com/PolymerLabs/tedium/issues

-->

[![Build status](https://travis-ci.org/PolymerElements/iron-a11y-keys-behavior.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-a11y-keys-behavior)

_[Demo and API docs](https://elements.polymer-project.org/elements/iron-a11y-keys-behavior)_


##Polymer.IronA11yKeysBehavior

`Polymer.IronA11yKeysBehavior` provides a normalized interface for processing
keyboard commands that pertain to [WAI-ARIA best practices](http://www.w3.org/TR/wai-aria-practices/#kbd_general_binding).
The element takes care of browser differences with respect to Keyboard events
and uses an expressive syntax to filter key presses.

Use the `keyBindings` prototype property to express what combination of keys
will trigger the callback. A key binding has the format
`"KEY+MODIFIER:EVENT": "callback"` (`"KEY": "callback"` or
`"KEY:EVENT": "callback"` are valid as well). Some examples:

```javascript
 keyBindings: {
   'space': '_onKeydown', // same as 'space:keydown'
   'shift+tab': '_onKeydown',
   'enter:keypress': '_onKeypress',
   'esc:keyup': '_onKeyup'
 }
```

The callback will receive with an event containing the following information in `event.detail`:

```javascript
 _onKeydown: function(event) {
   console.log(event.detail.combo); // KEY+MODIFIER, e.g. "shift+tab"
   console.log(event.detail.key); // KEY only, e.g. "tab"
   console.log(event.detail.event); // EVENT, e.g. "keydown"
   console.log(event.detail.keyboardEvent); // the original KeyboardEvent
 }
```

Use the `keyEventTarget` attribute to set up event handlers on a specific
node.

See the [demo source code](https://github.com/PolymerElements/iron-a11y-keys-behavior/blob/master/demo/x-key-aware.html)
for an example.

---
_Source: https://npm.io/package/@npm-polymer/iron-a11y-keys-behavior · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
