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

Unified Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2814023004: [MD Bookmarks] Right click on bookmark items open context menu. (Closed)
Patch Set: fix_nit Created 3 years, 8 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 | « chrome/browser/resources/md_bookmarks/list.html ('k') | chrome/test/data/webui/md_bookmarks/item_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/list.js
diff --git a/chrome/browser/resources/md_bookmarks/list.js b/chrome/browser/resources/md_bookmarks/list.js
index 6952696a2e86c6bfd41384d541fb3a3b33d92d07..c38b6da7fa26e40059358dcc22a4fc61dd45653d 100644
--- a/chrome/browser/resources/md_bookmarks/list.js
+++ b/chrome/browser/resources/md_bookmarks/list.js
@@ -54,7 +54,14 @@ Polymer({
this.menuItem_ = e.detail.item;
var menu = /** @type {!CrActionMenuElement} */ (
this.$.dropdown);
- menu.showAt(/** @type {!Element} */ (e.detail.target));
+ if (e.detail.targetElement) {
+ menu.showAt(/** @type {!Element} */ (e.detail.targetElement));
+ } else {
+ menu.showAtPosition({
+ top: e.detail.y,
+ left: e.detail.x,
+ });
+ }
},
/** @private */
@@ -87,6 +94,20 @@ Polymer({
this.closeDropdownMenu_();
},
+ /**
+ * Close the menu on mousedown so clicks can propagate to the underlying UI.
+ * This allows the user to right click the list while a context menu is
+ * showing and get another context menu.
+ * @param {Event} e
+ * @private
+ */
+ onMenuMousedown_: function(e) {
+ if (e.path[0] != this.$.dropdown)
+ return;
+
+ this.closeDropdownMenu_();
+ },
+
/** @private */
closeDropdownMenu_: function() {
var menu = /** @type {!CrActionMenuElement} */ (
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.html ('k') | chrome/test/data/webui/md_bookmarks/item_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698