Closed shashi closed 8 years ago
Can you specify which information is missing?
Hello @cdata sorry for the late response. What I did was:
I added this to the prototype, and then call it from my app under the event handler for "keys-pressed"
event.
keyboardEventToKey: function (event) {
return {
shift: event.shiftKey,
ctrl: event.ctrlKey,
meta: event.metaKey,
alt: event.altKey,
key: normalizedKeyForEvent(event)
};
},
Notice that normalizedKeyForEvent
is only inside the scope of core-a11y-keys and so adding this to the prototype was necessary.
Hi @shashi, this information should be available on the keys-pressed
event detail
, but is not.
The bug is here, where instead of doing var detail = Object.create(keyCombo)
, we should do something like:
var detail = {
keyCombo: keyCombo,
keyboardEvent: keyboardEvent
};
Feel free to do a PR for this, it would be much appreciated :)
Update: this information is already available in event.detail
, in fact you can access to keyCombo
properties, e.g. event.detail.combo, event.detail.key, event.detail.hasModifiers
etc..
@shashi is your request to add a public method keyboardEventToKey
added to iron-a11y-keys-behavior
?
Closing as pending response for 22 days & not actionable
In core-a11y-keys the keyboard event was passed through
keyboardEventToKey
function which was very helpful because one didn't have to memorize or look up key codes. event.detail contained exactly the amount of information required. Can we have it back? (can I make a Pull-request or is there a reason this was removed?)