Can\'t figure out why in the following polymer I am unable to get the keypressHandler function to be called. What am I doing wrong? (I tried putting the on-keypress attribute
When you press a key, the system has to know where to send the event. This is why there is a concept of focus
. For your element to receive keys it must be focused.
You can make it focus-able by setting tabIndex
, e.g.
ready: function() { this.tabIndex = 0; }
Now you can cause your element to be focused by calling the focus()
method on the element (this.focus()
), or by tabbing to it or clicking on it.
Once your element is focused, it should receive key presses.