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

Side by Side Diff: chrome/browser/resources/print_preview/search/destination_list_item.js

Issue 2586113002: MD Settings: ignore modified key events in the profile avatar grid (Closed)
Patch Set: closure Created 3 years, 12 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Component that renders a destination item in a destination list. 9 * Component that renders a destination item in a destination list.
10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection 10 * @param {!cr.EventTarget} eventTarget Event target to dispatch selection
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 }, 221 },
222 222
223 /** 223 /**
224 * Called when the key is pressed on the destination item. Dispatches a 224 * Called when the key is pressed on the destination item. Dispatches a
225 * SELECT event when Enter is pressed. 225 * SELECT event when Enter is pressed.
226 * @param {KeyboardEvent} e Keyboard event to process. 226 * @param {KeyboardEvent} e Keyboard event to process.
227 * @private 227 * @private
228 */ 228 */
229 onKeyDown_: function(e) { 229 onKeyDown_: function(e) {
230 if (!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) { 230 if (!hasKeyModifiers(e)) {
231 if (e.keyCode == 13) { 231 if (e.keyCode == 13) {
232 var activeElementTag = document.activeElement ? 232 var activeElementTag = document.activeElement ?
233 document.activeElement.tagName.toUpperCase() : ''; 233 document.activeElement.tagName.toUpperCase() : '';
234 if (activeElementTag == 'LI') { 234 if (activeElementTag == 'LI') {
235 e.stopPropagation(); 235 e.stopPropagation();
236 e.preventDefault(); 236 e.preventDefault();
237 this.onActivate_(); 237 this.onActivate_();
238 } 238 }
239 } 239 }
240 } 240 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 window.open('chrome://extensions?id=' + this.destination_.extensionId); 274 window.open('chrome://extensions?id=' + this.destination_.extensionId);
275 }, 275 },
276 276
277 /** 277 /**
278 * Handles key down event for the extensin icon element. Keys different than 278 * Handles key down event for the extensin icon element. Keys different than
279 * 'Enter' are ignored. 279 * 'Enter' are ignored.
280 * @param {KeyboardEvent} e The event to handle. 280 * @param {KeyboardEvent} e The event to handle.
281 * @private 281 * @private
282 */ 282 */
283 onExtensionIconKeyDown_: function(e) { 283 onExtensionIconKeyDown_: function(e) {
284 if (e.shiftKey || e.ctrlKey || e.altKey || e.metaKey) 284 if (hasKeyModifiers(e))
285 return; 285 return;
286 if (e.keyCode != 13 /* Enter */) 286 if (e.keyCode != 13 /* Enter */)
287 return; 287 return;
288 this.onExtensionIconClicked_(event); 288 this.onExtensionIconClicked_(event);
289 } 289 }
290 }; 290 };
291 291
292 // Export 292 // Export
293 return { 293 return {
294 DestinationListItem: DestinationListItem 294 DestinationListItem: DestinationListItem
295 }; 295 };
296 }); 296 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698