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

Unified Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js

Issue 2012593002: [Media Router WebUI] Fix search focus handlers when search is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
index 26362e10a694143a51d0fba9b523a486a1fd99af..a10eaac20d8376ec76a8aa4c566a534292a9fb56 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -455,7 +455,6 @@ Polymer({
this.$$('#focus-placeholder').remove();
document.addEventListener('keydown', this.onKeydown_.bind(this), true);
- this.setSearchFocusHandlers_();
this.listen(this, 'focus', 'onFocus_');
this.listen(this, 'header-height-changed', 'updateElementPositioning_');
this.listen(this, 'header-or-arrow-click', 'toggleCastModeHidden_');
@@ -2054,6 +2053,7 @@ Polymer({
searchEnabledChanged_: function(searchEnabled) {
if (searchEnabled) {
this.async(function() {
+ this.setSearchFocusHandlers_();
this.putSearchAtBottom_();
});
}
@@ -2079,7 +2079,6 @@ Polymer({
* @private
*/
setSearchFocusHandlers_: function() {
- var search = this.$$('#sink-search');
var searchInput = this.$$('#sink-search-input');
var that = this;
@@ -2095,15 +2094,13 @@ Polymer({
// |showSearchResults_()|.
window.addEventListener('blur', function() {
that.isSearchFocusedOnWindowBlur_ =
- that.shadowRoot.activeElement == search;
+ that.shadowRoot.activeElement == searchInput;
+ });
+ searchInput.addEventListener('focus', function() {
+ if (!that.isSearchFocusedOnWindowBlur_) {
+ that.showSearchResults_();
+ }
});
- if (this.hasConditionalElement_(search)) {
- searchInput.addEventListener('focus', function() {
- if (!that.isSearchFocusedOnWindowBlur_) {
- that.showSearchResults_();
- }
- });
- }
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698