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

Unified Diff: chrome/browser/resources/md_downloads/crisper.js

Issue 2074483003: MD Downloads: hide ... (more options) menu on resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: michaelpg review Created 4 years, 6 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_downloads/toolbar.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_downloads/crisper.js
diff --git a/chrome/browser/resources/md_downloads/crisper.js b/chrome/browser/resources/md_downloads/crisper.js
index ec1c8ee40f0ec7cdf6784e18db7b35eb4966a3b6..1cc539c15d3ea3ffdc0f4a989e36bf5cb2f93ba5 100644
--- a/chrome/browser/resources/md_downloads/crisper.js
+++ b/chrome/browser/resources/md_downloads/crisper.js
@@ -4141,7 +4141,7 @@ var ActionLink = document.registerElement('action-link', {
this.setAttribute('role', 'link');
this.addEventListener('keydown', function(e) {
- if (!this.disabled && e.key == 'Enter' && !this.href) {
+ if (!this.disabled && e.keyIdentifier == 'Enter' && !this.href) {
// Schedule a click asynchronously because other 'keydown' handlers
// may still run later (e.g. document.addEventListener('keydown')).
// Specifically options dialogs break when this timeout isn't here.
@@ -11227,6 +11227,11 @@ cr.define('downloads', function() {
},
},
+ listeners: {
+ 'paper-dropdown-close': 'onPaperDropdownClose_',
+ 'paper-dropdown-open': 'onPaperDropdownOpen_',
+ },
+
/** @return {boolean} Whether removal can be undone. */
canUndo: function() {
return this.$['search-input'] != this.shadowRoot.activeElement;
@@ -11252,12 +11257,26 @@ cr.define('downloads', function() {
this.updateClearAll_();
},
+ /** @private */
+ onPaperDropdownClose_: function() {
+ window.removeEventListener('resize', assert(this.boundResize_));
+ },
+
+ /** @private */
+ onPaperDropdownOpen_: function() {
+ this.boundResize_ = this.boundResize_ || function() {
+ this.$.more.close();
+ }.bind(this);
+ window.addEventListener('resize', this.boundResize_);
+ },
+
/**
* @param {!CustomEvent} event
* @private
*/
onSearchChanged_: function(event) {
- downloads.ActionService.getInstance().search(event.detail);
+ downloads.ActionService.getInstance().search(
+ /** @type {string} */ (event.detail));
this.updateClearAll_();
},
@@ -11469,4 +11488,4 @@ cr.define('downloads', function() {
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-window.addEventListener('load', downloads.Manager.onLoad);
+window.addEventListener('load', downloads.Manager.onLoad);
« no previous file with comments | « no previous file | chrome/browser/resources/md_downloads/toolbar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698