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

Side by Side Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js

Issue 2945433002: MD Settings: fix incorrect behavior with Enter on bluetooth item's icon-button. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview Polymer element for displaying a bluetooth device in a list. 6 * @fileoverview Polymer element for displaying a bluetooth device in a list.
7 */ 7 */
8 8
9 Polymer({ 9 Polymer({
10 is: 'bluetooth-device-list-item', 10 is: 'bluetooth-device-list-item',
11 11
12 behaviors: [I18nBehavior], 12 behaviors: [I18nBehavior],
13 13
14 properties: { 14 properties: {
15 /** 15 /**
16 * The bluetooth device. 16 * The bluetooth device.
17 * @type {!chrome.bluetooth.Device} 17 * @type {!chrome.bluetooth.Device}
18 */ 18 */
19 device: { 19 device: {
20 type: Object, 20 type: Object,
21 }, 21 },
22 }, 22 },
23 23
24 listeners: {
25 'keydown': 'onKeyDown_',
26 },
27
28 /**
29 * This is necessary, otherwise pressing enter will first trigger iron-list's
30 * keydown handler and intefere with icon-button's on-tap behavior.
31 * @param {!Event} event
32 * @private
33 */
34 onKeyDown_: function(event) {
35 if (event.key == 'Enter' &&
36 Polymer.dom(event).rootTarget ==
37 this.$$('button[is="paper-icon-button-light"]')) {
38 event.stopPropagation();
39 }
40 },
dschuyler 2017/06/20 18:46:51 When we have a chance, I'd like to chat about whet
scottchen 2017/06/20 19:17:19 I think we might've talked about this before, but
stevenjb 2017/07/10 22:48:53 Can this be done more simply like: <button ... on
scottchen 2017/07/12 19:12:49 Looks like yes we can! PTAL.
41
24 /** 42 /**
25 * @param {!Event} event 43 * @param {!Event} event
26 * @private 44 * @private
27 */ 45 */
28 onMenuButtonTap_: function(event) { 46 onMenuButtonTap_: function(event) {
29 var button = /** @type {!HTMLElement} */ (event.target); 47 var button = /** @type {!HTMLElement} */ (event.target);
30 var menu = /** @type {!CrActionMenuElement} */ (this.$.dotsMenu); 48 var menu = /** @type {!CrActionMenuElement} */ (this.$.dotsMenu);
31 menu.showAt(button); 49 menu.showAt(button);
32 event.stopPropagation(); 50 event.stopPropagation();
33 }, 51 },
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 case 'tablet': 147 case 'tablet':
130 return 'settings:tablet'; 148 return 'settings:tablet';
131 case 'mouse': 149 case 'mouse':
132 return 'settings:mouse'; 150 return 'settings:mouse';
133 default: 151 default:
134 return device.connected ? 152 return device.connected ?
135 'settings:bluetooth-connected' : 'settings:bluetooth'; 153 'settings:bluetooth-connected' : 'settings:bluetooth';
136 } 154 }
137 }, 155 },
138 }); 156 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698