Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a check to see if modifiers are alone #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<head>
<meta charset="UTF-8">
<title>Iron A11y Keys Behavior demo</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="x-key-aware.html">
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
<link rel="import" href="../bower_components/iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../bower_components/iron-demo-helpers/demo-pages-shared-styles.html">

<custom-style><style is="custom-style" include="demo-pages-shared-styles"></style></custom-style>
</head>
Expand Down
2 changes: 1 addition & 1 deletion demo/x-key-aware.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../iron-a11y-keys-behavior.html">

<dom-module id="x-key-aware">
Expand Down
8 changes: 6 additions & 2 deletions iron-a11y-keys-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@
event: 'keydown'
};
}
return keyComboString.split('+').reduce(function(parsedKeyCombo, keyComboPart) {
var splitKeyComboString = keyComboString.split('+');

return splitKeyComboString.reduce(function(parsedKeyCombo, keyComboPart) {
var eventParts = keyComboPart.split(':');
var keyName = eventParts[0];
var event = eventParts[1];

if (keyName in MODIFIER_KEYS) {
// allow modifier keys to be their own event
var MoreThanModifier = splitKeyComboString.length > 1;
if (MoreThanModifier && keyName in MODIFIER_KEYS) {
parsedKeyCombo[MODIFIER_KEYS[keyName]] = true;
parsedKeyCombo.hasModifiers = true;
} else {
Expand Down
8 changes: 4 additions & 4 deletions test/basic-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>iron-a11y-keys</title>

<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>
<script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<script src="../bower_components/web-component-tester/browser.js"></script>
<script src="../bower_components/iron-test-helpers/mock-interactions.js"></script>

<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../iron-a11y-keys-behavior.html">
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>Tests</title>

<script src="../../web-component-tester/browser.js"></script>
<script src="../bower_components/web-component-tester/browser.js"></script>
</head>

<body>
Expand Down