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

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

Issue 2153323002: MD Downloads: rework "more actions" menu focus handling code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: asdf 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
Index: chrome/browser/resources/md_downloads/toolbar.js
diff --git a/chrome/browser/resources/md_downloads/toolbar.js b/chrome/browser/resources/md_downloads/toolbar.js
index 2c586881218adb9192fff4c02ce379b3c7be6684..b4c0527844355c5861cdb2fdb528ac9d22b12250 100644
--- a/chrome/browser/resources/md_downloads/toolbar.js
+++ b/chrome/browser/resources/md_downloads/toolbar.js
@@ -45,9 +45,8 @@ cr.define('downloads', function() {
},
/** @private */
- onClearAllTap_: function() {
- assert(this.canClearAll());
- downloads.ActionService.getInstance().clearAll();
+ closeMoreActions_: function() {
+ this.$.more.close();
},
/** @private */
@@ -56,16 +55,36 @@ cr.define('downloads', function() {
},
/** @private */
+ onClearAllTap_: function() {
+ assert(this.canClearAll());
+ downloads.ActionService.getInstance().clearAll();
+ },
+
+ /** @private */
onPaperDropdownClose_: function() {
- window.removeEventListener('resize', assert(this.boundResize_));
+ window.removeEventListener('resize', assert(this.boundClose_));
+ },
+
+ /**
+ * @param {!Event} e
+ * @private
+ */
+ onItemBlur_: function(e) {
+ var menu = /** @type {PaperMenuElement} */(this.$$('paper-menu'));
+ if (menu.items.indexOf(e.relatedTarget) >= 0)
+ return;
+
+ // This can be this.$.more.restoreFocusOnClose = false when this lands:
+ // https://github.com/PolymerElements/paper-menu-button/pull/94
+ this.$.more.$.dropdown.restoreFocusOnClose = false;
+ this.closeMoreActions_();
+ this.$.more.$.dropdown.restoreFocusOnClose = true;
},
/** @private */
onPaperDropdownOpen_: function() {
- this.boundResize_ = this.boundResize_ || function() {
- this.$.more.close();
- }.bind(this);
- window.addEventListener('resize', this.boundResize_);
+ this.boundClose_ = this.boundClose_ || this.closeMoreActions_.bind(this);
+ window.addEventListener('resize', this.boundClose_);
},
/**
« no previous file with comments | « chrome/browser/resources/md_downloads/toolbar.html ('k') | chrome/browser/resources/md_downloads/vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698