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

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

Issue 2025583002: MD WebUI: Improve tab focus behavior for toolbar search field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 7 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 aac426820c43e00e97956025673933bea7ae198f..2d60fd9b3926346bf133da3882e77abca05f7e7d 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
@@ -25,6 +25,15 @@ Polymer({
'tap': 'showSearch_',
},
+ /**
+ * @param {boolean} narrow
+ * @return {number}
+ * @private
+ */
+ computeIconTabIndex_: function(narrow) {
+ return narrow ? 0 : -1;
+ },
+
/** @private */
onInputBlur_: function() {
if (!this.hasSearchText)
@@ -32,6 +41,16 @@ Polymer({
},
/**
+ * Expand the search field when a key is pressed with it focused. This ensures
+ * it can be used correctly by tab-focusing. We use keypress instead of
dpapad 2016/06/01 01:27:10 Thanks for adding the explanatory comment, it help
tsergeant 2016/06/01 01:46:35 Done.
+ * keydown to avoid expanding on non-text keys (shift, escape, etc).
+ * @private
+ */
+ onSearchTermKeypress_: function() {
+ this.showingSearch = true;
+ },
+
+ /**
* @param {Event} e
* @private
*/
« 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