Up to higher level directory | |||
Name | Date | Size | |
---|---|---|---|
.bower.json | 06-Dec-2016 | 1.3K | |
.gitignore | 06-Dec-2016 | 17 | |
.travis.yml | 06-Dec-2016 | 1.8K | |
bower.json | 06-Dec-2016 | 965 | |
CONTRIBUTING.md | 06-Dec-2016 | 3.4K | |
demo/ | 06-Dec-2016 | ||
index.html | 06-Dec-2016 | 809 | |
iron-a11y-keys-behavior.html | 06-Dec-2016 | 15.4K | |
README.md | 06-Dec-2016 | 2K | |
test/ | 06-Dec-2016 |
1 2 <!--- 3 4 This README is automatically generated from the comments in these files: 5 iron-a11y-keys-behavior.html 6 7 Edit those files, and our readme bot will duplicate them over here! 8 Edit this file, and the bot will squash your changes :) 9 10 The bot does some handling of markdown. Please file a bug if it does the wrong 11 thing! https://github.com/PolymerLabs/tedium/issues 12 13 --> 14 15 [![Build status](https://travis-ci.org/PolymerElements/iron-a11y-keys-behavior.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-a11y-keys-behavior) 16 17 _[Demo and API docs](https://elements.polymer-project.org/elements/iron-a11y-keys-behavior)_ 18 19 20 ##Polymer.IronA11yKeysBehavior 21 22 `Polymer.IronA11yKeysBehavior` provides a normalized interface for processing 23 keyboard commands that pertain to [WAI-ARIA best practices](http://www.w3.org/TR/wai-aria-practices/#kbd_general_binding). 24 The element takes care of browser differences with respect to Keyboard events 25 and uses an expressive syntax to filter key presses. 26 27 Use the `keyBindings` prototype property to express what combination of keys 28 will trigger the callback. A key binding has the format 29 `"KEY+MODIFIER:EVENT": "callback"` (`"KEY": "callback"` or 30 `"KEY:EVENT": "callback"` are valid as well). Some examples: 31 32 ```javascript 33 keyBindings: { 34 'space': '_onKeydown', // same as 'space:keydown' 35 'shift+tab': '_onKeydown', 36 'enter:keypress': '_onKeypress', 37 'esc:keyup': '_onKeyup' 38 } 39 ``` 40 41 The callback will receive with an event containing the following information in `event.detail`: 42 43 ```javascript 44 _onKeydown: function(event) { 45 console.log(event.detail.combo); // KEY+MODIFIER, e.g. "shift+tab" 46 console.log(event.detail.key); // KEY only, e.g. "tab" 47 console.log(event.detail.event); // EVENT, e.g. "keydown" 48 console.log(event.detail.keyboardEvent); // the original KeyboardEvent 49 } 50 ``` 51 52 Use the `keyEventTarget` attribute to set up event handlers on a specific 53 node. 54 55 See the [demo source code](https://github.com/PolymerElements/iron-a11y-keys-behavior/blob/master/demo/x-key-aware.html) 56 for an example. 57 58 59