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

Side by Side Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2947753003: [MD Bookmarks] Fix offscreen menu button activation. (Closed)
Patch Set: fix closure 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'bookmarks-list', 6 is: 'bookmarks-list',
7 7
8 behaviors: [ 8 behaviors: [
9 bookmarks.StoreClient, 9 bookmarks.StoreClient,
10 ], 10 ],
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 /** 126 /**
127 * @param{HTMLElement} el 127 * @param{HTMLElement} el
128 * @private 128 * @private
129 */ 129 */
130 getIndexForItemElement_: function(el) { 130 getIndexForItemElement_: function(el) {
131 return this.$.bookmarksCard.modelForElement(el).index; 131 return this.$.bookmarksCard.modelForElement(el).index;
132 }, 132 },
133 133
134 /** 134 /**
135 * @param {Event} e
136 * @private
137 */
138 onOpenItemMenu_: function(e) {
139 var index = this.displayedIds_.indexOf(
140 /** @type {BookmarksItemElement} */ (e.target).itemId);
141 var list = this.$.bookmarksCard;
142 // If the item is not visible, scroll to it before rendering the menu.
143 if (index < list.firstVisibleIndex || index > list.lastVisibleIndex)
144 list.scrollToIndex(index);
145 },
146
147 /**
135 * @param {KeyboardEvent} e 148 * @param {KeyboardEvent} e
136 * @private 149 * @private
137 */ 150 */
138 onItemKeydown_: function(e) { 151 onItemKeydown_: function(e) {
139 var handled = true; 152 var handled = true;
140 var list = this.$.bookmarksCard; 153 var list = this.$.bookmarksCard;
141 var focusMoved = false; 154 var focusMoved = false;
142 var focusedIndex = 155 var focusedIndex =
143 this.getIndexForItemElement_(/** @type {HTMLElement} */ (e.target)); 156 this.getIndexForItemElement_(/** @type {HTMLElement} */ (e.target));
144 var oldFocusedIndex = focusedIndex; 157 var oldFocusedIndex = focusedIndex;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 212
200 if (!handled) { 213 if (!handled) {
201 handled = bookmarks.CommandManager.getInstance().handleKeyEvent( 214 handled = bookmarks.CommandManager.getInstance().handleKeyEvent(
202 e, this.getState().selection.items); 215 e, this.getState().selection.items);
203 } 216 }
204 217
205 if (handled) 218 if (handled)
206 e.stopPropagation(); 219 e.stopPropagation();
207 }, 220 },
208 }); 221 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698