OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Component that renders a destination item in a destination list. | 9 * Component that renders a destination item in a destination list. |
10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection | 10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 /** | 144 /** |
145 * Called when the text element value is changed. | 145 * Called when the text element value is changed. |
146 * @private | 146 * @private |
147 */ | 147 */ |
148 onTextInput_: function() { | 148 onTextInput_: function() { |
149 this.selectedValue_ = this.text_.value || null; | 149 this.selectedValue_ = this.text_.value || null; |
150 | 150 |
151 if (this.query_) { | 151 if (this.query_) { |
152 var optionMatches = (this.selectedValue_ || '').match(this.query_); | 152 var optionMatches = (this.selectedValue_ || '').match(this.query_); |
153 // Even if there's no match anymore, keep the item visible to do not | 153 // Even if there's no match anymore, keep the item visible to do not |
154 // surprise user. | 154 // surprise user. Even if there's a match, do not show the bubble, user |
155 if (optionMatches) | 155 // is already aware that this option is visible and matches the search. |
156 this.showSearchBubble_(optionMatches[0]); | 156 // Showing the bubble will only create a distraction by moving UI |
157 else | 157 // elements around. |
| 158 if (!optionMatches) |
158 this.hideSearchBubble_(); | 159 this.hideSearchBubble_(); |
159 } | 160 } |
160 }, | 161 }, |
161 | 162 |
162 /** | 163 /** |
163 * @param {!Object} entity Entity to get the display name for. Entity in | 164 * @param {!Object} entity Entity to get the display name for. Entity in |
164 * is either a vendor capability or vendor capability option. | 165 * is either a vendor capability or vendor capability option. |
165 * @return {string} The entity display name. | 166 * @return {string} The entity display name. |
166 * @private | 167 * @private |
167 */ | 168 */ |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 310 } |
310 }); | 311 }); |
311 } | 312 } |
312 }; | 313 }; |
313 | 314 |
314 // Export | 315 // Export |
315 return { | 316 return { |
316 AdvancedSettingsItem: AdvancedSettingsItem | 317 AdvancedSettingsItem: AdvancedSettingsItem |
317 }; | 318 }; |
318 }); | 319 }); |
OLD | NEW |