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

Unified Diff: ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js

Issue 2586803002: MD Settings: Fix label visibility in subpage search fields (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
diff --git a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
index 3de204caa0e8a73008efac0bb36d4b15b9a4fbfb..6ebc105e84bca5c392fc6f530b257671deaa863d 100644
--- a/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
+++ b/ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js
@@ -32,9 +32,6 @@ Polymer({
spinnerActive: {type: Boolean, reflectToAttribute: true},
/** @private */
- hasSearchText_: {type: Boolean, reflectToAttribute: true},
-
- /** @private */
isSpinnerShown_: {
type: Boolean,
computed: 'computeIsSpinnerShown_(spinnerActive, showingSearch)'
@@ -54,17 +51,6 @@ Polymer({
return this.$.searchInput;
},
- /**
- * Sets the value of the search field. Overridden from CrSearchFieldBehavior.
- * @param {string} value
- * @param {boolean=} opt_noEvent Whether to prevent a 'search-changed' event
- * firing for this change.
- */
- setValue: function(value, opt_noEvent) {
- CrSearchFieldBehavior.setValue.call(this, value, opt_noEvent);
- this.onSearchInput_();
- },
-
/** @return {boolean} */
isSearchFocused: function() {
return this.searchFocused_;
@@ -75,6 +61,11 @@ Polymer({
this.focus_();
},
+ onSearchTermInput: function() {
+ CrSearchFieldBehavior.onSearchTermInput.call(this);
+ this.showingSearch = this.hasSearchText || this.isSearchFocused();
+ },
+
/** @private */
focus_: function() {
this.getSearchInput().focus();
@@ -105,23 +96,10 @@ Polymer({
/** @private */
onInputBlur_: function() {
this.searchFocused_ = false;
- if (!this.hasSearchText_)
+ if (!this.hasSearchText)
this.showingSearch = false;
},
- /**
- * Update the state of the search field whenever the underlying input value
- * changes. Unlike onsearch or onkeypress, this is reliably called immediately
- * after any change, whether the result of user input or JS modification.
- * @private
- */
- onSearchInput_: function() {
- var newValue = this.$.searchInput.value;
- this.hasSearchText_ = newValue != '';
- if (newValue != '')
- this.showingSearch = true;
- },
-
/** @private */
onSearchTermKeydown_: function(e) {
if (e.key == 'Escape')
« no previous file with comments | « ui/webui/resources/cr_elements/cr_toolbar/cr_toolbar_search_field.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698