PolymerElements / iron-a11y-keys

A basic element implementation of iron-a11y-keys-behavior
19 stars 22 forks source link

add support for "only" modifier #24

Closed d1manson closed 8 years ago

d1manson commented 8 years ago

Currently, the main key matching logic is:

keyEvent === keyCombo.key && (!keyCombo.hasModifiers || ( /* exact match of modifiers */)

But sometimes you specifically want only an unmodified key, e.g. only the key z and not alt-z or shift-z etc. In particular, this is necessary when you want to register separate handlers for the modified and unmodified cases.

I suggest using the modifier only, for example:

key="z+only"

If only is combined with other modifiers it has no special effect because the matching logic tests all possible modifiers as soon as any one modifier is included.

I am about to submit a PR implementing this with the addition of 2 lines.

d1manson commented 8 years ago

Oops, this was meant for the -behavior repo.

https://github.com/PolymerElements/iron-a11y-keys-behavior/issues/41