Open anandanand84 opened 7 years ago
alt + a produces a keyboard event which has event.key = 'å'
. I'm not sure this can be solved by iron-a11y-keys
, as it's clearly a different behavior on what's returned by the event.key
.
+1
@danbeam
alt + a produces a keyboard event which has
event.key = 'å'
. I'm not sure this can be solved byiron-a11y-keys
, as it's clearly a different behavior on what's returned by theevent.key
.
Actually, the problem is not the fact that a key like "å"is produced. Even if one registers a keyboard shortcut as follows on Mac, it does not trigger at all.
behaviors: [
Polymer.IronA11yKeysBehavior,
],
keyBindings: {
'alt+ç': 'onMyShortcut_',
},
Digging through the code, there seems to be an arbitrary limitation in iron-a11y-keys-behavior, at https://github.com/PolymerElements/iron-a11y-keys-behavior/blob/dd98dccceb6db2d8fab9204d0bc45a192911c7f6/iron-a11y-keys-behavior.js#L190-L191, where only alpha-numeric keys are allowed when modifiers are used.
// For combos with modifiers we support only alpha-numeric keys
var keyEvent = normalizedKeyForEvent(event, keyCombo.hasModifiers);
Further following this codepath, it goes into transformKey
at https://github.com/PolymerElements/iron-a11y-keys-behavior/blob/dd98dccceb6db2d8fab9204d0bc45a192911c7f6/iron-a11y-keys-behavior.js#L104, which basically converts "ç" to the empty string, therefore causing such shortcuts to never fire.
Is there a good reason for this limitation? If noSpecialChars
is always passed as false
then shortcuts like Alt+c on Mac work fine, as long as they are registered in the code as alt+ç
.
Or at the very least, there should be a way to turn off the noSpecialChars
logic from a specific element that uses the IronA11yKeysBehavior.
Description
The
iron-ally-keys
element does not work with alt modifier in chrome,firefox,opera on mac. But works with safari and windows. It can be seen in the demo page. https://elements.polymer-project.org/elements/iron-a11y-keys?view=demo:demo/index.html&active=iron-a11y-keys Navigate to demo page in chrome on mac and press alt+aExpected outcome
It should display alt+a.
Actual outcome
Nothing is displayed
Live Demo
https://elements.polymer-project.org/elements/iron-a11y-keys?view=demo:demo/index.html&active=iron-a11y-keys
Steps to reproduce
Browsers Affected