OLD | NEW |
1 /** | 1 /** |
2 `iron-a11y-keys` provides a cross-browser interface for processing | 2 `iron-a11y-keys` provides a cross-browser interface for processing |
3 keyboard commands. The interface adheres to [WAI-ARIA best | 3 keyboard commands. The interface adheres to [WAI-ARIA best |
4 practices](http://www.w3.org/TR/wai-aria-practices/#kbd_general_binding). | 4 practices](http://www.w3.org/TR/wai-aria-practices/#kbd_general_binding). |
5 It uses an expressive syntax to filter key presses. | 5 It uses an expressive syntax to filter key presses. |
6 | 6 |
7 ## Basic usage | 7 ## Basic usage |
8 | 8 |
9 The sample code below is a portion of a custom element. The goal is to call | 9 The sample code below is a portion of a custom element. The goal is to call |
10 the `onEnter` method whenever the `paper-input` element is in focus and | 10 the `onEnter` method whenever the `paper-input` element is in focus and |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 The following is an example of the set of keys that fulfills WAI-ARIA's | 90 The following is an example of the set of keys that fulfills WAI-ARIA's |
91 "slider" role [best | 91 "slider" role [best |
92 practices](http://www.w3.org/TR/wai-aria-practices/#slider): | 92 practices](http://www.w3.org/TR/wai-aria-practices/#slider): |
93 | 93 |
94 <iron-a11y-keys target="[[target]]" keys="left pagedown down" | 94 <iron-a11y-keys target="[[target]]" keys="left pagedown down" |
95 on-keys-pressed="decrement"></iron-a11y-keys> | 95 on-keys-pressed="decrement"></iron-a11y-keys> |
96 <iron-a11y-keys target="[[target]]" keys="right pageup up" | 96 <iron-a11y-keys target="[[target]]" keys="right pageup up" |
97 on-keys-pressed="increment"></iron-a11y-keys> | 97 on-keys-pressed="increment"></iron-a11y-keys> |
98 <iron-a11y-keys target="[[target]]" keys="home" | 98 <iron-a11y-keys target="[[target]]" keys="home" |
99 on-keys-pressed="setMin"></iron-a11y-keys> | 99 on-keys-pressed="setMin"></iron-a11y-keys> |
100 <iron-a11y-keys target=""[[target]] keys="end" | 100 <iron-a11y-keys target="[[target]]" keys="end" |
101 on-keys-pressed="setMax"></iron-a11y-keys> | 101 on-keys-pressed="setMax"></iron-a11y-keys> |
102 | 102 |
103 The `target` properties must evaluate to a node. See the basic usage | 103 The `target` properties must evaluate to a node. See the basic usage |
104 example above. | 104 example above. |
105 | 105 |
106 Each of the values for the `on-keys-pressed` attributes must evalute | 106 Each of the values for the `on-keys-pressed` attributes must evalute |
107 to methods. The `increment` method should move the slider a set amount | 107 to methods. The `increment` method should move the slider a set amount |
108 toward the maximum value. `decrement` should move the slider a set amount | 108 toward the maximum value. `decrement` should move the slider a set amount |
109 toward the minimum value. `setMin` should move the slider to the minimum | 109 toward the minimum value. `setMin` should move the slider to the minimum |
110 value. `setMax` should move the slider to the maximum value. | 110 value. `setMax` should move the slider to the maximum value. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 _keysChanged: function() { | 148 _keysChanged: function() { |
149 this.removeOwnKeyBindings(); | 149 this.removeOwnKeyBindings(); |
150 this.addOwnKeyBinding(this.keys, '_fireKeysPressed'); | 150 this.addOwnKeyBinding(this.keys, '_fireKeysPressed'); |
151 }, | 151 }, |
152 | 152 |
153 _fireKeysPressed: function(event) { | 153 _fireKeysPressed: function(event) { |
154 this.fire('keys-pressed', event.detail, {}); | 154 this.fire('keys-pressed', event.detail, {}); |
155 } | 155 } |
156 }); | 156 }); |
OLD | NEW |