I use iron-list from google Polymer.
<iron-list items="[[data]]" as="item">
<template>
<div tabindex$="[[tabIndex]]">
Name: [[item.name]]
</div>
</template>
</iron-list>
I kwon you can use Polymer.IronA11yKeysBehavior but even with the example I have no idea how I add it in JavaScript to my iron-list.
Using Vaadin Polymer GWT lib. In this lib you have
IronList list;
list.setKeyBindings(???); // don't know how to use this function
list.setKeyEventTarget(????); // don't know how to use this function
When I check the current values of the key bindings I defined a print function to log a variable to the console:
public native void print(JavaScriptObject obj) /-{ console.log(obj); }-/;
Then I print the current values with:
print(list.getKeyBindings());
The result is:
Object {up: "_didMoveUp", down: "_didMoveDown", enter: "_didEnter"}
It seem that there are some key bindings already defined, but I have no idea where I find the functions _didMoveUp
, _didMoveDown
and _didEnter
.
When I do
print(list.getKeyEventTarget());
I get:
<iron-list class="fit x-scope iron-list-0" tabindex="1" style="overflow: auto;">
</iron-list>
How can I set up a handler for capturing keyboard events using Vaadin Polymer GWT lib? How can I receive an event when keys like enter are pressed?