OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 Polymer({ | 5 Polymer({ |
6 is: 'gaia-button', | 6 is: 'gaia-button', |
7 | 7 |
8 properties: { | 8 properties: { |
9 disabled: { | 9 disabled: { |
10 type: Boolean, | 10 type: Boolean, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 }); | 44 }); |
45 | 45 |
46 Polymer({ | 46 Polymer({ |
47 is: 'gaia-icon-button', | 47 is: 'gaia-icon-button', |
48 | 48 |
49 properties: { | 49 properties: { |
50 disabled: { | 50 disabled: { |
51 type: Boolean, | 51 type: Boolean, |
52 value: false, | 52 value: false, |
53 observer: 'disabledChanged_', | |
54 reflectToAttribute: true | 53 reflectToAttribute: true |
55 }, | 54 }, |
56 | 55 |
57 icon: String, | 56 icon: String, |
58 | 57 |
59 ariaLabel: String | 58 ariaLabel: String |
60 }, | 59 }, |
61 | 60 |
62 focus: function() { | 61 focus: function() { |
63 this.$.iconButton.focus(); | 62 this.$.iconButton.focus(); |
64 }, | 63 }, |
65 | 64 |
66 onClick_: function(e) { | 65 onClick_: function(e) { |
67 if (this.disabled) | 66 if (this.disabled) |
68 e.stopPropagation(); | 67 e.stopPropagation(); |
69 }, | |
70 | |
71 disabledChanged_: function(disabled) { | |
72 // TODO(dzhioev): remove after | |
73 // https://github.com/PolymerElements/paper-icon-button/issues/20 is fixed. | |
74 if (!disabled) { | |
75 this.async(function() { | |
76 this.$.iconButton.tabIndex = '0'; | |
77 }); | |
78 } | |
79 } | 68 } |
80 }); | 69 }); |
81 | 70 |
OLD | NEW |