PolymerElements / iron-a11y-keys-behavior

A behavior that enables keybindings for greater a11y
24 stars 41 forks source link

Bug on with Polymer 2 (key events aren't catched) #78

Closed RoXuS closed 7 years ago

RoXuS commented 7 years ago

Description

If I don't add the following lines in the ready() function, the key events are not catched:

    ready() {
      super.ready();
      this._prepKeyBindings();
      this.keyEventTarget = document.body;
    }

Live Demo

http://jsbin.com/zeraputiyi/1/edit?html,console,output

Browsers Affected

valdrinkoshi commented 7 years ago

keyBindings is expected to be a prototype property - see demo as example. IronA11yKeysBehavior will collect the key bindings when registered, but the properties from the properties block will be created when the element is connected (later).

tl;dr you can have a getter for keyBindings to solve this issue http://jsbin.com/dazedes/1/edit?html,console,output

RoXuS commented 7 years ago

Oh great ! Thx !