Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: polymer_1.2.3/bower_components/iron-a11y-keys-behavior/demo/x-key-aware.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --> 9 -->
10 10
11 <link rel="import" href="../../polymer/polymer.html"> 11 <link rel="import" href="../../polymer/polymer.html">
12 <link rel="import" href="../../paper-styles/paper-styles.html"> 12 <link rel="import" href="../../paper-styles/color.html">
13 <link rel="import" href="../iron-a11y-keys-behavior.html"> 13 <link rel="import" href="../iron-a11y-keys-behavior.html">
14 14
15 <dom-module id="x-key-aware"> 15 <dom-module id="x-key-aware">
16 <style> 16 <style>
17 :host { 17 :host {
18 display: block; 18 display: block;
19 position: relative; 19 position: relative;
20 } 20 }
21 21
22 pre { 22 pre {
23 color: var(--google-blue-700); 23 color: var(--google-blue-700);
24 } 24 }
25 25
26 .keys { 26 .keys {
27 line-height: 25px; 27 line-height: 25px;
28 } 28 }
29 29
30 .keys span { 30 .keys span {
31 cursor: default; 31 cursor: default;
32 background-color: var(--google-grey-100); 32 background-color: var(--google-grey-100);
33 border: 1px solid var(--google-grey-300); 33 border: 1px solid var(--google-grey-300);
34 padding: 1px 5px; 34 padding: 1px 5px;
35 border-radius: 5px; 35 border-radius: 5px;
36 } 36 }
37 </style> 37 </style>
38 <template> 38 <template>
39 <h4>Press any of these keys</h4> 39 <h4>Press any of these keys</h4>
40 <input type="checkbox" checked="{{preventDefault::change}}"> prevent default = {{preventDefault}}
40 <p class="keys"> 41 <p class="keys">
41 <template is="dom-repeat" items="[[boundKeys]]"> 42 <template is="dom-repeat" items="[[boundKeys]]">
42 <span>{{item}}</span> 43 <span>{{item}}</span>
43 </template> 44 </template>
44 </p> 45 </p>
45 <pre>[[pressed]]</pre> 46 <pre>[[pressed]]</pre>
46 </template> 47 </template>
47 </dom-module> 48 </dom-module>
48 49
49 <script> 50 <script>
(...skipping 11 matching lines...) Expand all
61 value: '' 62 value: ''
62 }, 63 },
63 64
64 boundKeys: { 65 boundKeys: {
65 type: Array, 66 type: Array,
66 value: function() { 67 value: function() {
67 return Object.keys(this.keyBindings).join(' ').split(' '); 68 return Object.keys(this.keyBindings).join(' ').split(' ');
68 } 69 }
69 }, 70 },
70 71
72 preventDefault: {
73 type: Boolean,
74 value: true,
75 notify: true
76 },
77
71 keyEventTarget: { 78 keyEventTarget: {
72 type: Object, 79 type: Object,
73 value: function() { 80 value: function() {
74 return document.body; 81 return document.body;
75 } 82 }
76 } 83 }
77 }, 84 },
78 85
79 keyBindings: { 86 keyBindings: {
80 '* pageup pagedown left right down up shift+a alt+a home end space enter': '_updatePressed' 87 '* pageup pagedown left right down up home end space enter @ ~ " $ ? ! \\ + : # backspace': '_updatePressed',
88 'a': '_updatePressed',
89 'shift+a alt+a': '_updatePressed',
90 'shift+tab shift+space': '_updatePressed'
81 }, 91 },
82 92
83 _updatePressed: function(event) { 93 _updatePressed: function(event) {
84 console.log(event.detail); 94 console.log(event.detail);
85 95
96 if (this.preventDefault) {
97 event.preventDefault();
98 }
86 this._setPressed( 99 this._setPressed(
87 this.pressed + event.detail.combo + ' pressed!\n' 100 this.pressed + event.detail.combo + ' pressed!\n'
88 ); 101 );
89 } 102 }
90 }); 103 });
91 </script> 104 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698