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

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

Issue 2947753003: [MD Bookmarks] Fix offscreen menu button activation. (Closed)
Patch Set: address comment Created 3 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 | « chrome/browser/resources/md_bookmarks/compiled_resources2.gyp ('k') | no next file » | 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 c14fee3a875d948df19b170085da4ecbf1dce45f..e011bbc77e4d3158d824e53d036d16c76759f28f 100644
--- a/chrome/browser/resources/md_bookmarks/list.js
+++ b/chrome/browser/resources/md_bookmarks/list.js
@@ -46,6 +46,7 @@ Polymer({
listeners: {
'click': 'deselectItems_',
+ 'open-item-menu': 'onOpenItemMenu_',
},
attached: function() {
@@ -131,6 +132,19 @@ Polymer({
return this.$.bookmarksCard.modelForElement(el).index;
},
+ /**
+ * @param {Event} e
+ * @private
+ */
+ onOpenItemMenu_: function(e) {
+ var index = this.displayedIds_.indexOf(
+ /** @type {BookmarksItemElement} */ (e.path[0]).itemId);
+ var list = this.$.bookmarksCard;
+ // If the item is not visible, scroll to it before rendering the menu.
+ if (index < list.firstVisibleIndex || index > list.lastVisibleIndex)
+ list.scrollToIndex(index);
+ },
+
/**
* @param {KeyboardEvent} e
* @private
« no previous file with comments | « chrome/browser/resources/md_bookmarks/compiled_resources2.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698