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

Unified Diff: chrome/browser/resources/md_history/history_list.js

Issue 2644733003: MD History: Scroll history-items into view when their action menu is opened (Closed)
Patch Set: Created 3 years, 11 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_history/app.crisper.js ('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_history/history_list.js
diff --git a/chrome/browser/resources/md_history/history_list.js b/chrome/browser/resources/md_history/history_list.js
index fad3d1bd205257e43a1b4e967048a7038a92516c..f7239534b48478536ab04610b5061cd587e9753a 100644
--- a/chrome/browser/resources/md_history/history_list.js
+++ b/chrome/browser/resources/md_history/history_list.js
@@ -29,6 +29,7 @@ Polymer({
listeners: {
'remove-bookmark-stars': 'removeBookmarkStars_',
+ 'open-menu': 'onOpenMenu_',
},
/** @override */
@@ -105,6 +106,19 @@ Polymer({
},
/**
+ * Ensure that the item is visible in the scroll pane when its menu is
+ * opened (it is possible to open off-screen items using keyboard shortcuts).
+ * @param {Event} e
+ * @private
+ */
+ onOpenMenu_: function(e) {
+ var index = e.detail.index;
+ var list = /** @type {IronListElement} */ (this.$['infinite-list']);
+ if (index < list.firstVisibleIndex || index > list.lastVisibleIndex)
+ list.scrollToIndex(index);
+ },
+
+ /**
* Check whether the time difference between the given history item and the
* next one is large enough for a spacer to be required.
* @param {HistoryEntry} item
« no previous file with comments | « chrome/browser/resources/md_history/app.crisper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698