Chromium Code Reviews| Index: chrome/browser/resources/settings/settings_ui/settings_ui.js |
| diff --git a/chrome/browser/resources/settings/settings_ui/settings_ui.js b/chrome/browser/resources/settings/settings_ui/settings_ui.js |
| index c2b378aca4c6ccec8608cb973dd4c4426cd55b3e..affd985e7fe567bb46e2415d33c9bf1421d4454a 100644 |
| --- a/chrome/browser/resources/settings/settings_ui/settings_ui.js |
| +++ b/chrome/browser/resources/settings/settings_ui/settings_ui.js |
| @@ -131,14 +131,20 @@ Polymer({ |
| * @private |
| */ |
| onSearchChanged_: function(e) { |
| - var query = e.detail; |
|
Dan Beam
2016/10/26 20:51:11
i think this entire patch could be
- var query =
dpapad
2016/11/03 21:00:11
See latest patch for a very similar approach.
|
| + // Ignore query if it contains whitespace only. |
| + // TODO(dpapad): Should this be done by cr_search_field_behavior instead? |
|
dpapad
2016/10/25 23:38:41
MD History would probably benefit by moving this l
Dan Beam
2016/10/26 02:10:03
can we just put the fix in a shared place? downlo
|
| + if (/^\s+$/.test(e.detail)) |
|
dpapad
2016/10/25 23:38:41
FWIW, I looked into Downloads, specifically at [1]
|
| + return; |
|
Dan Beam
2016/10/26 20:51:11
this code is wrong. consider moving from ' a' to
dpapad
2016/11/03 21:00:11
Addressed in latest patch.
|
| + |
| + var query = e.detail.trim(); |
| - // 'search-changed' event was fired only because the search box's value was |
| - // updated to reflect the already existing search URL parameter, no need to |
| - // navigate again. |
| var existingQuery = settings.getQueryParameters().get('search') || ''; |
| - if (query == existingQuery) |
| + if (query == existingQuery) { |
| + // 'search-changed' event was fired only because the search box's value |
| + // was updated to reflect the already existing search URL parameter, no |
| + // need to navigate again. |
| return; |
| + } |
| settings.navigateTo( |
| settings.Route.BASIC, |