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

Unified Diff: chrome/browser/resources/md_history/app.js

Issue 2152753003: MD History: Fix forward slash key not working in search field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments Created 4 years, 5 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 | « no previous file | chrome/browser/resources/md_history/history.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_history/app.js
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js
index 6d3f5d4e2d111d016111463a05fa1550b1bec366..a451b9ff679cd694c08a30868d3707007f7df203 100644
--- a/chrome/browser/resources/md_history/app.js
+++ b/chrome/browser/resources/md_history/app.js
@@ -118,7 +118,18 @@ Polymer({
* @private
*/
onCanExecute_: function(e) {
- e.canExecute = true;
+ e = /** @type {cr.ui.CanExecuteEvent} */(e);
+ switch (e.command.id) {
+ case 'find-command':
+ e.canExecute = true;
+ break;
+ case 'slash-command':
+ var field =
+ /** @type {CrSearchFieldElement} */ this.$.toolbar.$['main-toolbar']
Dan Beam 2016/07/15 05:28:51 this type should technically be just "SearchField"
lshang 2016/07/19 01:23:00 Or it should be "CrToolbarSearchFieldElement"? tho
+ .getSearchField();
Dan Beam 2016/07/15 05:28:51 you should expose this through both HistoryToolbar
lshang 2016/07/19 01:23:00 Done.
+ e.canExecute = !(field.showingSearch && field.focused);
+ break;
+ }
},
/**
@@ -126,7 +137,7 @@ Polymer({
* @private
*/
onCommand_: function(e) {
- if (e.command.id == 'find-command')
+ if (e.command.id == 'find-command' || e.command.id == 'slash-command')
this.$.toolbar.showSearchField();
},
« no previous file with comments | « no previous file | chrome/browser/resources/md_history/history.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698