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

Side by Side Diff: lib/src/iron-collapse/iron-collapse.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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
« no previous file with comments | « lib/src/iron-behaviors/test/active-state.html ('k') | lib/src/iron-collapse/test/a11y.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 this.style.transitionDuration = (enabled && this._enableTransition) ? '' : '0s'; 155 this.style.transitionDuration = (enabled && this._enableTransition) ? '' : '0s';
156 }, 156 },
157 157
158 _horizontalChanged: function() { 158 _horizontalChanged: function() {
159 this.dimension = this.horizontal ? 'width' : 'height'; 159 this.dimension = this.horizontal ? 'width' : 'height';
160 this.style.transitionProperty = this.dimension; 160 this.style.transitionProperty = this.dimension;
161 }, 161 },
162 162
163 _openedChanged: function() { 163 _openedChanged: function() {
164 if (this.opened) { 164 if (this.opened) {
165 this.setAttribute('aria-expanded', 'true');
166 this.setAttribute('aria-hidden', 'false');
167
165 this.toggleClass('iron-collapse-closed', false); 168 this.toggleClass('iron-collapse-closed', false);
166 this.updateSize('auto', false); 169 this.updateSize('auto', false);
167 var s = this._calcSize(); 170 var s = this._calcSize();
168 this.updateSize('0px', false); 171 this.updateSize('0px', false);
169 // force layout to ensure transition will go 172 // force layout to ensure transition will go
170 /** @suppress {suspiciousCode} */ this.offsetHeight; 173 /** @suppress {suspiciousCode} */ this.offsetHeight;
171 this.updateSize(s, true); 174 this.updateSize(s, true);
172 } 175 // focus the current collapse
173 else { 176 this.focus();
177 } else {
178 this.setAttribute('aria-expanded', 'false');
179 this.setAttribute('aria-hidden', 'true');
180
174 this.toggleClass('iron-collapse-opened', false); 181 this.toggleClass('iron-collapse-opened', false);
175 this.updateSize(this._calcSize(), false); 182 this.updateSize(this._calcSize(), false);
176 // force layout to ensure transition will go 183 // force layout to ensure transition will go
177 /** @suppress {suspiciousCode} */ this.offsetHeight; 184 /** @suppress {suspiciousCode} */ this.offsetHeight;
178 this.updateSize('0px', true); 185 this.updateSize('0px', true);
179 } 186 }
180 this.setAttribute('aria-expanded', this.opened ? 'true' : 'false');
181
182 }, 187 },
183 188
184 _transitionEnd: function() { 189 _transitionEnd: function() {
185 if (this.opened) { 190 if (this.opened) {
186 this.updateSize('auto', false); 191 this.updateSize('auto', false);
187 } 192 }
188 this.toggleClass('iron-collapse-closed', !this.opened); 193 this.toggleClass('iron-collapse-closed', !this.opened);
189 this.toggleClass('iron-collapse-opened', this.opened); 194 this.toggleClass('iron-collapse-opened', this.opened);
190 this.enableTransition(false); 195 this.enableTransition(false);
191 }, 196 },
192 197
193 _calcSize: function() { 198 _calcSize: function() {
194 return this.getBoundingClientRect()[this.dimension] + 'px'; 199 return this.getBoundingClientRect()[this.dimension] + 'px';
195 }, 200 },
196 201
197 202
198 }); 203 });
199 204
200 </script> 205 </script>
OLDNEW
« no previous file with comments | « lib/src/iron-behaviors/test/active-state.html ('k') | lib/src/iron-collapse/test/a11y.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698